2016-06-09 100 views
0

我是Gate Nlp的新手。我有超过100个文件要处理。但在处理20-25个文档后,抛出out of memory exception。因此,我现在想用datastore来存储语料库。因此它会在处理它之后释放内存。我有一个gapp应用程序文件,通过它加载文档。我的代码是这样如何在嵌入式门户使用数据存储NLP

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(); 
     } 

在此之后,我也删除语料。经删除,它不清除内存我。怎么能解决这个问题?

回答

0

在您的示例中,您创建了一个没有Seri​​alDatastore的语料库。 你可以找到真正的SerialDatastore使用的例子here

相关问题