【发布时间】:2015-04-17 10:19:24
【问题描述】:
我使用Gate Developer 开发了一个应用程序,它应用了 paum 算法并将结果显示在一个名为“output”的新注释集中,其中包含一个名为“comment”的注释。
然后,我在 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();
然后我尝试检查“输出”注释集是否包含某些内容:
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 开发人员中,我设置了带有特性的“输出”注释集,但在 Gate Embedded 中没有。我想了解为什么会这样。
编辑
下面是我在 Gate Developer 中得到的截图。
应用 PR 后,会创建一个名为“output”的注释集,其中包含一个名为“comment”的注释。
但是在 Gate Embedded 中,我没有这个“评论”注释。
提前谢谢你,
【问题讨论】: