如何使用GATE嵌入式(Java代码)获取单词的功能,如下例所示:
type=Token;
features={category=VBG, kind=word, orth=lowercase, length=7, string=lacking};
start=NodeImpl;
id=21453;
答案 0 :(得分:2)
如果你使用opennlp pos标记它应该是这样的,因为“Token”是你的标记注释:
token.getFeatures()。get(“category”)。toString()
应该给你对应于pos标签的字符串。
答案 1 :(得分: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());
}
}