我使用Gate
Developer开发了一个应用程序,它应用paum算法并将结果显示在一个名为" output"的新注释集中。有一个名为"注释"。
然后,我在Gate Embedded上导入了这个应用程序。 然而,"输出"使用Gate Embedded生成的注释集没有任何注释!
修改
这就是我的进展:
ArrayList<Tweet> listTweets = ...
ArrayList<Document> listDocument = new ArrayList<Document>();
//initialize Gate library
Gate.setGateHome(new File("E_Reputation/"));
Gate.setPluginsHome(new File("E_Reputation/plugins/"));
Gate.setUserConfigFile(new File("config/user-gate.xml"));
Gate.setSiteConfigFile(new File("config/site-gate.xml"));
Gate.init();
//load Gate application
CorpusController applicationGate = (CorpusController) PersistenceManager.loadObjectFromFile(new File("E_Reputation/application.xgapp"));
corpus = Factory.newCorpus("Tweets");corpus = Factory.newCorpus("Tweets");
//populate the corpus
for(i=0;i<listTweets.size();i++) {
//Document doc = Factory.newDocument(listTweets.get(i).getText());
FeatureMap params = Factory.newFeatureMap();
params.put(Document.DOCUMENT_STRING_CONTENT_PARAMETER_NAME,listTweets.get(i).getText());
Document doc = (Document) Factory.createResource("gate.corpora.DocumentImpl", params);
Long start=gate.Utils.start(doc);
Long end = gate.Utils.end(doc);
doc.getAnnotations("Key").add(start, end, " ", Factory.newFeatureMap());
listDocument.add(doc);
corpus.add(listDocument.get(i));
}
//execute Gate application
applicationGate.setCorpus(corpus);
applicationGate.execute();
然后我尝试检查&#34;输出&#34;注释集包含一些内容:
for(Document document:listDocument) {
Set<String> allAnnSet = document.getAnnotationSetNames();
System.out.println(allAnnSet.contains("output")); // return true
AnnotationSet annSet = document.getAnnotations("output");
List<Annotation> listAnn = annSet.inDocumentOrder();
System.out.println(annSet.size()); // return 0
System.out.println(listAnn.size()); // return 0
}
语料库与我在Gate Developer中使用的语料库相同。在Gate开发人员中,我有&#34;输出&#34;注释设置功能但不在Gate Embedded中。我想知道为什么会这样。
修改
下面是我在Gate Developer中获得的截图。
在应用PR之后,注释集称为&#34;输出&#34;有一个名为&#34;注释&#34;的注释创建。
但是在Gate Embedded中,我没有这个&#34;评论&#34;注解。
提前谢谢你,
答案 0 :(得分:2)
听起来我觉得你在注释集和注释类型之间感到困惑 - 注释集本身没有特征。如果您在GATE Developer注释集树中看到的是
然后你没有一个名为“output”的注释 set ,而是默认注释集(没有名称)中 type “output”的注释。要访问这些,您可以使用
之类的代码for(Document document:listDocument) {
AnnotationSet annSet = document.getAnnotations().get("output");