我正在尝试编写自己的规则来注释我的java代码中的作者(来自author,jape)我已经初始化了新的处理resource.The代码,运行得很好,但没有注释ma text: input: who is the Author of xyz output:它应该被注释为author,并将图书的名称保存在某个临时变量中。我的java代码:
Gate.init();
Gate.getCreoleRegister().registerDirectories(
new File(Gate.getPluginsHome(), "ANNIE").toURI().toURL());
SerialAnalyserController pipeline =
(SerialAnalyserController)gate.Factory.createResource(
"gate.creole.SerialAnalyserController");
LanguageAnalyser tokeniser = (LanguageAnalyser)gate.Factory.createResource(
"gate.creole.tokeniser.DefaultTokeniser");
LanguageAnalyser jape = (LanguageAnalyser)gate.Factory.createResource(
"gate.creole.Transducer", gate.Utils.featureMap(
"grammarURL", new File("E:\\GATE_Developer_7.1\\plugins\\ANNIE\\resources\\NE\\Author.jape").toURI().toURL(),
"encoding", "UTF-8"));
pipeline.add(tokeniser);
pipeline.add(jape);
Corpus corpus = gate.Factory.newCorpus(null);
Document doc = gate.Factory.newDocument("Who is author of Inception");
DocumentContent dc=doc.getContent();
corpus.add(doc);
pipeline.setCorpus(corpus);
pipeline.execute();
System.out.println("Found annotations of the following types: " +
doc.getAnnotations().getAllTypes());在输出中它只给出令牌,空格令牌有人能帮我解决这个问题吗?
发布于 2016-08-05 13:55:10
这里是您为注释指定的名称,您可以使用它。因此,您可以使用此方法。
doc.getAnnotations().get("Name of the annotations which you want to get");https://stackoverflow.com/questions/22293143
复制相似问题