【发布时间】:2016-06-09 09:41:58
【问题描述】:
我是Gate Nlp 的新手。我有 100 多份文件要处理。但在处理 20-25 个文档后,抛出 out of memory exception 。所以,我现在想使用datastore 来存储语料库。这样它会在处理完之后释放内存。我有一个应用程序的gapp 文件,它通过它加载文档。我的代码就像
if (!Gate.isInitialised()) {
Gate.runInSandbox(true);
Gate.init();
}
application = (CorpusController) PersistenceManager.loadObjectFromFile(gapFile);
// Create a Corpus to use. We recycle the same Corpus object for each
// iteration. The string parameter to newCorpus() is simply the
// GATE-internal name to use for the corpus. It has no particular
// significance.
corpus = Factory.newCorpus(AppConstants.MAIN_CORPUS);
application.setCorpus(corpus);
doc = Factory.newDocument(new File(docFilePath).toURI().toURL());
// put the document in the corpus
corpus.add(doc);
// run the application
application.execute();
}
在此之后我正在删除语料库。删除后也没有清除内存。我该如何解决这个问题?
【问题讨论】: