Package org.maltparserx.parser.history.action

Examples of org.maltparserx.parser.history.action.SingleDecision


  public boolean predict(GuideDecision decision) throws MaltChainedException {
//    if (decision instanceof SingleDecision) {
//      throw new GuideException("A branched decision model expect more than one decisions. ");
//    }
    featureModel.update();
    final SingleDecision singleDecision = ((MultipleDecision)decision).getSingleDecision(decisionIndex);
    if (instanceModel == null) {
      initInstanceModel(singleDecision.getTableContainer().getTableContainerName());
    }
    instanceModel.predict(singleDecision);
    if (decisionIndex+1 < decision.numberOfDecisions()) {
      if (singleDecision.continueWithNextDecision()) {
        if (children == null) {
          children = new HashMap<Integer,DecisionModel>();
        }
        DecisionModel child = children.get(singleDecision.getDecisionCode());
        if (child == null) {
          child = initChildDecisionModel(((MultipleDecision)decision).getSingleDecision(decisionIndex+1),
              branchedDecisionSymbols+(branchedDecisionSymbols.length() == 0?"":"_")+singleDecision.getDecisionSymbol());
          children.put(singleDecision.getDecisionCode(), child);
        }
        child.predict(decision);
      }
    }
View Full Code Here


  public FeatureVector predictExtract(GuideDecision decision) throws MaltChainedException {
    if (decision instanceof SingleDecision) {
      throw new GuideException("A branched decision model expect more than one decisions. ");
    }
    featureModel.update();
    final SingleDecision singleDecision = ((MultipleDecision)decision).getSingleDecision(decisionIndex);
    if (instanceModel == null) {
      initInstanceModel(singleDecision.getTableContainer().getTableContainerName());
    }
    FeatureVector fv = instanceModel.predictExtract(singleDecision);
    if (decisionIndex+1 < decision.numberOfDecisions()) {
      if (singleDecision.continueWithNextDecision()) {
        if (children == null) {
          children = new HashMap<Integer,DecisionModel>();
        }
        DecisionModel child = children.get(singleDecision.getDecisionCode());
        if (child == null) {
          child = initChildDecisionModel(((MultipleDecision)decision).getSingleDecision(decisionIndex+1),
              branchedDecisionSymbols+(branchedDecisionSymbols.length() == 0?"":"_")+singleDecision.getDecisionSymbol());
          children.put(singleDecision.getDecisionCode(), child);
        }
        child.predictExtract(decision);
      }
    }
View Full Code Here

    if (decision instanceof SingleDecision) {
      throw new GuideException("A branched decision model expect more than one decisions. ");
    }
   
    boolean success = false;
    final SingleDecision singleDecision = ((MultipleDecision)decision).getSingleDecision(decisionIndex);
    if (decisionIndex+1 < decision.numberOfDecisions()) {
      if (singleDecision.continueWithNextDecision()) {
        if (children == null) {
          children = new HashMap<Integer,DecisionModel>();
        }
        DecisionModel child = children.get(singleDecision.getDecisionCode());
        if (child != null) {
          success = child.predictFromKBestList(decision);
        }
       
      }
    }
    if (!success) {
      success = singleDecision.updateFromKBestList();
      if (decisionIndex+1 < decision.numberOfDecisions()) {
        if (singleDecision.continueWithNextDecision()) {
          if (children == null) {
            children = new HashMap<Integer,DecisionModel>();
          }
          DecisionModel child = children.get(singleDecision.getDecisionCode());
          if (child == null) {
            child = initChildDecisionModel(((MultipleDecision)decision).getSingleDecision(decisionIndex+1),
                branchedDecisionSymbols+(branchedDecisionSymbols.length() == 0?"":"_")+singleDecision.getDecisionSymbol());
            children.put(singleDecision.getDecisionCode(), child);
          }
          child.predict(decision);
        }
      }
    }
View Full Code Here

  public void addInstance(GuideDecision decision) throws MaltChainedException {
    if (decision instanceof SingleDecision) {
      throw new GuideException("A sequantial decision model expect a sequence of decisions, not a single decision. ");
    }
    featureModel.update();
    final SingleDecision singleDecision = ((MultipleDecision)decision).getSingleDecision(decisionIndex);
    if (instanceModel == null) {
      initInstanceModel(singleDecision.getTableContainer().getTableContainerName());
    }
    instanceModel.addInstance(singleDecision);
    if (singleDecision.continueWithNextDecision() && decisionIndex+1 < decision.numberOfDecisions()) {
      if (nextDecisionModel == null) {
        initNextDecisionModel(((MultipleDecision)decision).getSingleDecision(decisionIndex+1), branchedDecisionSymbols);
      }
      nextDecisionModel.addInstance(decision);
    }
View Full Code Here

  public boolean predict(GuideDecision decision) throws MaltChainedException {
    if (decision instanceof SingleDecision) {
      throw new GuideException("A sequantial decision model expect a sequence of decisions, not a single decision. ");
    }
    featureModel.update();
    final SingleDecision singleDecision = ((MultipleDecision)decision).getSingleDecision(decisionIndex);
    if (instanceModel == null) {
      initInstanceModel(singleDecision.getTableContainer().getTableContainerName());
    }

    boolean success = instanceModel.predict(singleDecision);
    if (singleDecision.continueWithNextDecision() && decisionIndex+1 < decision.numberOfDecisions()) {
      if (nextDecisionModel == null) {
        initNextDecisionModel(((MultipleDecision)decision).getSingleDecision(decisionIndex+1), branchedDecisionSymbols);
      }
      success = nextDecisionModel.predict(decision) && success;
    }
View Full Code Here

  public FeatureVector predictExtract(GuideDecision decision) throws MaltChainedException {
    if (decision instanceof SingleDecision) {
      throw new GuideException("A sequantial decision model expect a sequence of decisions, not a single decision. ");
    }
    featureModel.update();
    final SingleDecision singleDecision = ((MultipleDecision)decision).getSingleDecision(decisionIndex);
    if (instanceModel == null) {
      initInstanceModel(singleDecision.getTableContainer().getTableContainerName());
    }

    FeatureVector fv = instanceModel.predictExtract(singleDecision);
    if (singleDecision.continueWithNextDecision() && decisionIndex+1 < decision.numberOfDecisions()) {
      if (nextDecisionModel == null) {
        initNextDecisionModel(((MultipleDecision)decision).getSingleDecision(decisionIndex+1), branchedDecisionSymbols);
      }
      nextDecisionModel.predictExtract(decision);
    }
View Full Code Here

    if (decision instanceof SingleDecision) {
      throw new GuideException("A sequantial decision model expect a sequence of decisions, not a single decision. ");
    }
   
    boolean success = false;
    final SingleDecision singleDecision = ((MultipleDecision)decision).getSingleDecision(decisionIndex);
    // TODO develop different strategies for resolving which kBestlist that should be used
    if (nextDecisionModel != null && singleDecision.continueWithNextDecision()) {
      success = nextDecisionModel.predictFromKBestList(decision);
    }
    if (!success) {
      success = singleDecision.updateFromKBestList();
      if (success && singleDecision.continueWithNextDecision() && decisionIndex+1 < decision.numberOfDecisions()) {
        if (nextDecisionModel == null) {
          initNextDecisionModel(((MultipleDecision)decision).getSingleDecision(decisionIndex+1), branchedDecisionSymbols);
        }
        nextDecisionModel.predict(decision);
      }
View Full Code Here

    }
  }
 
  public void addInstance(GuideDecision decision) throws MaltChainedException {
    featureModel.update();
    final SingleDecision singleDecision = (decision instanceof SingleDecision)?(SingleDecision)decision:((MultipleDecision)decision).getSingleDecision(decisionIndex);
   
    if (instanceModel == null) {
      initInstanceModel(singleDecision.getTableContainer().getTableContainerName());
    }
    instanceModel.addInstance(singleDecision);
  }
View Full Code Here

    instanceModel.addInstance(singleDecision);
  }
 
  public boolean predict(GuideDecision decision) throws MaltChainedException {
    featureModel.update();
    final SingleDecision singleDecision = (decision instanceof SingleDecision)?(SingleDecision)decision:((MultipleDecision)decision).getSingleDecision(decisionIndex);

    if (instanceModel == null) {
      initInstanceModel(singleDecision.getTableContainer().getTableContainerName());
    }
    return instanceModel.predict(singleDecision);
  }
View Full Code Here

    return instanceModel.predict(singleDecision);
  }
 
  public FeatureVector predictExtract(GuideDecision decision) throws MaltChainedException {
    featureModel.update();
    final SingleDecision singleDecision = (decision instanceof SingleDecision)?(SingleDecision)decision:((MultipleDecision)decision).getSingleDecision(decisionIndex);

    if (instanceModel == null) {
      initInstanceModel(singleDecision.getTableContainer().getTableContainerName());
    }
    return instanceModel.predictExtract(singleDecision);
  }
View Full Code Here

TOP

Related Classes of org.maltparserx.parser.history.action.SingleDecision

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.