我正在尝试编写自己的规则,在我的 java 代码中注释作者(来自作者,jape)我已经初始化了我的新处理资源。代码运行正常但没有注释 ma text:输入:谁是 xyz 输出的作者:它应该被注释为作者和 shd 将书名保存在一些临时变量中。我的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());
在输出中它只给出令牌,空间令牌任何人都可以帮助我解决这个问题。?