0

如何使用 GATE 嵌入(Java 代码)获取单词的特征,如下例所示:

type=Token; 
features={category=VBG, kind=word, orth=lowercase, length=7, string=lacking}; 
start=NodeImpl; 
id=21453;
4

2 回答 2

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.

于 2013-11-18T21:33:28.383 回答
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());
  }

}
于 2014-02-16T06:58:48.120 回答