TermRaider 系统不是一个单一的 PR,它是一个完整的应用程序(实际上是一个 Groovy ScriptableController
)。资源只是使该TermraiderEnglish
应用程序出现在 GATE Developer GUI 的“现成应用程序”菜单中的一个挂钩。
在嵌入式代码中,您可以使用PersistenceManager
File termRaiderPlugin = new File(Gate.getPluginsHome(), "TermRaider");
File gappFile = new File(new File(termRaiderPlugin, "applications"),
"termraider-eng.gapp");
CorpusController trApp = (CorpusController)PersistenceManager.loadObjectFromFile(
gappFile);
当您在语料库上运行应用程序时,它会创建三个“术语库”LR 的新实例,其中包含有关新发现的术语的信息。vanilla 应用程序实际上是为 GUI 而不是嵌入式使用而设计的,因此它不会在任何有用的地方存储对这些新 LR 的引用——您必须查询CreoleRegister
它们才能找到它们。您可能更喜欢制作自己的应用程序副本并调整控制脚本以将术语库实例存储为(比如说)上的功能Corpus
,方法是添加类似
corpus.features.tfidfTermbank = termbank0
corpus.features.annotationTermbank = termbank1
corpus.features.hyponymyTermbank = termbank2
到控制脚本的末尾。然后,您可以通过corpus.getFeatures().get("tfidfTermbank")
etc在您的 Java 代码中访问它们。
由于这些 Termbank 类本身就是TermRaider
插件的一部分,因此您可能希望将其添加gate-termraider.jar
到您的主应用程序类路径中,而不是通过GateClassLoader
.