Annotate NPs within a list of NPs

Rule: List

((AND) {NP})*

//get the mention annotations in a list
List annList = new ArrayList((AnnotationSet)bindings.get("mention"));

//sort the list by offset
Collections.sort(annList, new OffsetComparator());

//iterate through the matched annotations
for(int i = 0; i < annList.size(); i++)
Annotation anAnn = (Annotation)annList.get(i);

// check that the new annotation is an NP
if ((anAnn.getType().equals("NP"))

FeatureMap features = Factory.newFeatureMap();
features.put("rule", "List1");

annotations.add(anAnn.getStartNode(), anAnn.getEndNode(), "SomeTag",


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License