Package org.apache.uima.ruta.textruler.core

Examples of org.apache.uima.ruta.textruler.core.TextRulerWordConstraint


  public List<MLLP2OtherConstraint> getOtherConstraints() {
    return otherConstraints;
  }

  public void setWordConstraint(TextRulerAnnotation tokenAnnotation) {
    setWordConstraint(new TextRulerWordConstraint(tokenAnnotation));
  }
View Full Code Here


      otherConstraints.add(c.copy());
  }

  public WhiskRuleItem(TextRulerAnnotation tokenAnnotation) {
    super();
    setWordConstraint(new TextRulerWordConstraint(tokenAnnotation));
  }
View Full Code Here

      // the before annotations have to be reversed:
      for (int i = before.size() - 1; i >= 0; i--) {
        AnnotationFS afs = before.get(i);
        RapierRuleItem ruleItem = new RapierRuleItem();
        ruleItem.addWordConstraint(new TextRulerWordConstraint(new TextRulerAnnotation(afs, example
                .getDocument())));
        addAvailablePosTagConstraintToItem(ruleItem, afs, example);
        rule.addPreFillerItem(ruleItem);
      }

      for (AnnotationFS afs : inside) {
        RapierRuleItem ruleItem = new RapierRuleItem();
        ruleItem.addWordConstraint(new TextRulerWordConstraint(new TextRulerAnnotation(afs, example
                .getDocument())));
        addAvailablePosTagConstraintToItem(ruleItem, afs, example);
        rule.addFillerItem(ruleItem);
      }
      for (AnnotationFS afs : after) {
        RapierRuleItem ruleItem = new RapierRuleItem();
        ruleItem.addWordConstraint(new TextRulerWordConstraint(new TextRulerAnnotation(afs, example
                .getDocument())));
        addAvailablePosTagConstraintToItem(ruleItem, afs, example);
        rule.addPostFillerItem(ruleItem);
      }
View Full Code Here

    this.activeFeatures = new ArrayList<String>(copyFrom.getActivatedFeatures());
  }

  public WhiskRuleItem(TextRulerAnnotation tokenAnnotation) {
    super();
    setWordConstraint(new TextRulerWordConstraint(tokenAnnotation));
  }
View Full Code Here

    for (TextRulerSlotPattern eachPattern : patterns) {
      for (TextRulerRuleItem item : eachPattern.fillerPattern) {
        if (item instanceof WhiskRuleItem) {
          WhiskRuleItem wri = (WhiskRuleItem) item;
          WhiskRule proposedRule = rule;
          TextRulerWordConstraint wordConstraint = wri.getWordConstraint();
          for (String eachFeature : consideredFeatures) {
            if (wordConstraint != null) {
              Map<String, String> featureMap = wordConstraint.getTokenAnnotation().getFeatureMap();
              String stringValue = featureMap.get(eachFeature);
              if (stringValue != null && !wri.getActivatedFeatures().contains(eachFeature)) {
                wri.activateFeature(eachFeature);
                WhiskRule proposedRuleF = proposedRule.copy();
                wri.deactivateFeature(eachFeature);
                proposedRuleF.setNeedsCompile(true);
                if (!rulesToTest.contains(proposedRuleF)) {
                  rulesToTest.add(proposedRuleF);
                }
              }
            }
          }
          if (wordConstraint != null && wordConstraint.isRegExpConstraint() && wri.isHideRegExp()) {
            wri.setHideRegExp(false);
            WhiskRule proposedRuleF = proposedRule.copy();
            wri.setHideRegExp(true);
            proposedRuleF.setNeedsCompile(true);
            if (!rulesToTest.contains(proposedRuleF)) {
View Full Code Here

      // the before annotations have to be reversed:
      for (int i = before.size() - 1; i >= 0; i--) {
        AnnotationFS afs = before.get(i);
        RapierRuleItem ruleItem = new RapierRuleItem();
        ruleItem.addWordConstraint(new TextRulerWordConstraint(new TextRulerAnnotation(afs, example
                .getDocument())));
        addAvailablePosTagConstraintToItem(ruleItem, afs, example);
        rule.addPreFillerItem(ruleItem);
      }

      for (AnnotationFS afs : inside) {
        RapierRuleItem ruleItem = new RapierRuleItem();
        ruleItem.addWordConstraint(new TextRulerWordConstraint(new TextRulerAnnotation(afs, example
                .getDocument())));
        addAvailablePosTagConstraintToItem(ruleItem, afs, example);
        rule.addFillerItem(ruleItem);
      }
      for (AnnotationFS afs : after) {
        RapierRuleItem ruleItem = new RapierRuleItem();
        ruleItem.addWordConstraint(new TextRulerWordConstraint(new TextRulerAnnotation(afs, example
                .getDocument())));
        addAvailablePosTagConstraintToItem(ruleItem, afs, example);
        rule.addPostFillerItem(ruleItem);
      }
View Full Code Here

  public List<MLLP2OtherConstraint> getOtherConstraints() {
    return otherConstraints;
  }

  public void setWordConstraint(TextRulerAnnotation tokenAnnotation) {
    setWordConstraint(new TextRulerWordConstraint(tokenAnnotation));
  }
View Full Code Here

      otherConstraints.add(c.copy());
  }

  public WhiskRuleItem(TextRulerAnnotation tokenAnnotation) {
    super();
    setWordConstraint(new TextRulerWordConstraint(tokenAnnotation));
  }
View Full Code Here

      otherConstraints.add(c.copy());
  }

  public WhiskRuleItem(TextRulerAnnotation tokenAnnotation) {
    super();
    setWordConstraint(new TextRulerWordConstraint(tokenAnnotation));
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.ruta.textruler.core.TextRulerWordConstraint

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.