如何使用GATE的ANNIE插件从文档中提取电子邮件ID?

时间:2015-11-16 11:29:51

标签: java information-retrieval gate information-extraction

我正在尝试使用ANNIE提取电子邮件的注释集。电子邮件是ANNIE提供的默认注释类型。 我使用以下代码: -

AnnotationSet defaultAnnotSet = doc.getAnnotations();
AnnotationSet curAnnSet;
curAnnSet = defaultAnnotSet.get("Email");

在这里,我得到空白的curAnnSet,不知道为什么

1 个答案:

答案 0 :(得分:0)

这可能有点晚了,但我不认为ANNIE提供了注释“电子邮件”。我记得一个注释“地址”。您需要创建一个JAPE规则,如下所示,以提取其类型。

({Address.kind=email}):email
-->
:email.Email= {rule = "Email"}

提取这样的注释:

if(defaultAnnotSet.get("Address").getFeatures().get("kind").toString().equals("email"))
{ 
//create new features
features.put("rule", "Email");

// create new annotation                                   
outputAS.add(defaultAnnotSet.firstNode(), defaultAnnotSet.lastNode(), "Email", features);

    }