All Downloads are FREE. Search and download functionalities are using the official Maven repository.

resources.grammar.first.jape Maven / Gradle / Ivy

There is a newer version: 8.6
Show newest version
/*
*  first.jape
*  $Id $
*/


Phase:	First
Input: Lookup Token
Options: control = appelt debug = false

Rule: Spurious
Priority:100

(
 {Lookup.majorType == stop_word}
 ):loc
 -->
{
  gate.AnnotationSet locSet = (gate.AnnotationSet)bindings.get("loc");
  gate.Annotation ann = (gate.Annotation) locSet.iterator().next();

  gate.AnnotationSet lookups = inputAS.get("Lookup", ann.getStartNode().getOffset(),
	ann.getEndNode().getOffset());

  if (lookups.size() <= 1)
    return;

  List annots = new ArrayList();
  Iterator iter = lookups.iterator();
  while (iter.hasNext()) {
    gate.Annotation annot = (gate.Annotation) iter.next();
    if (! annot.getFeatures().get("majorType").equals("stop_word"))
      annots.add(annot);
  }
  inputAS.removeAll(annots);
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy