2016-06-09 22 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

相關問題