0

How to get the features of words using GATE embedded (Java code) as in the following example:

type=Token; 
features={category=VBG, kind=word, orth=lowercase, length=7, string=lacking}; 
start=NodeImpl; 
id=21453;
Nizam
  • 5,698
  • 9
  • 45
  • 57
  • Can you show the code you've tried so far? What result are you getting and how does it differ from what you expect? – Ian Roberts Nov 07 '13 at 15:35

2 Answers2

2

If you use the opennlp pos tagging it should be something like this, given that "Token" is your annotation for tokens:

token.getFeatures().get("category").toString()

should give you the string corresponding to the pos tag.

0
Phase: Find_Features
Input:  Token 
Options: control = First

Rule: get_Token_features

(
 {Token}
):label

 -->

 :label
 {

 AnnotationSet tokens = inputAS.get("Token");

 for(Annotation t : tokens)
  {
   FeatureMap fm = t.getFeatures();
   System.out.println(fm);

 /* 
  If looking for specific features go for
  System.out.println( t.getFeatures().get("FeatureName").toString() );
 */

 System.out.println(t.getFeatures().get("category").toString());
  }

}