if (wordItem.getWordConstraint().isRegExpConstraint()) {
LP2RuleItem basicItem = new LP2RuleItem();
// basicItem.setOtherConstraint("basicTM", new
// MLLP2OtherConstraint(tokenAnnotation, tokenAnnotation));
basicItem.addOtherConstraint(new MLLP2OtherConstraint(tokenAnnotation, tokenAnnotation));
result.add(createStartRuleForConstraint(example.getTarget(), prePostIndex + 1, isPre,
basicItem));
}
// // POS-Tags created by our test hmm tagger.
// Type posTagsRootType = ts.getType("org.apache.uima.ml.ML.postag");
// if (posTagsRootType != null)
// {
// List<AnnotationFS> posTagAnnotations =
// TextRulerToolkit.getAnnotationsWithinBounds(example.getDocumentCAS(),
// tokenAnnotation.getBegin(), tokenAnnotation.getEnd(), null,
// posTagsRootType);
// if (posTagAnnotations.size()>0)
// {
// if (TextRulerToolkit.DEBUG && posTagAnnotations.size()>1)
// {
// TextRulerToolkit.logIfDebug("HOW CAN ONE TOKEN HAVE MORE THAN ONE POS TAG ?? "+tokenAnnotation.getBegin()+":"+tokenAnnotation.getEnd()+"="+tokenAnnotation.getCoveredText());
// for (AnnotationFS afs : posTagAnnotations)
// {
// System.out.print(afs.getType().getShortName()+":"+afs.getCoveredText()+" "+afs.getBegin()+":"+afs.getEnd()+"\n");
// }
// TextRulerToolkit.logIfDebug("");
// }
//
// TextRulerAnnotation posTagAnnotation = new
// TextRulerAnnotation(posTagAnnotations.get(0),
// example.getDocument());
// LP2RuleItem basicItem = new LP2RuleItem();
// basicItem.setOtherConstraint("postag", new
// MLLP2OtherConstraint(posTagAnnotation, posTagAnnotation));
// result.add(createStartRuleForConstraint(example.getTarget(),
// prePostIndex+1, isPre, basicItem));
// }
// }
// new dynamic system: grab everything we get from the annotation
// index that lies over this token:
// (annotations WITHIN (with smaller bounds than the token itself)
// are ignored for now! we could
// add using them with the CONTAINS constraint. but our
// MLLP2OtherConstraint is not yet capable of this!
List<AnnotationFS> featureAnnotations = TextRulerToolkit.getOtherAnnotationsOverToken(docCas,
tokenAFS, filterSetWithSlotNames);
if (TextRulerToolkit.DEBUG && featureAnnotations.size() > 1) {
TextRulerToolkit.log("FOUND MORE THAN ONE EXTRA TOKEN FEATURE ANNOTATION !");
for (AnnotationFS featA : featureAnnotations)
TextRulerToolkit.log(featA.toString());
TextRulerToolkit.log("--------------------------------");
}
for (AnnotationFS featA : featureAnnotations) {
TextRulerAnnotation featureAnnot = new TextRulerAnnotation(featA, example.getDocument());
LP2RuleItem basicItem = new LP2RuleItem();
basicItem.addOtherConstraint(new MLLP2OtherConstraint(tokenAnnotation, featureAnnot));
result.add(createStartRuleForConstraint(example.getTarget(), prePostIndex + 1, isPre,
basicItem));
}
}