【问题标题】:How to use Data-Store in Embedded Gate NLP如何在 Embedded Gate NLP 中使用 Data-Store
【发布时间】: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();
        }

在此之后我正在删除语料库。删除后也没有清除内存。我该如何解决这个问题?

【问题讨论】:

    标签: java nlp gate


    【解决方案1】:

    在您的示例中,您创建了一个没有 SerialDatastore 的语料库。 您可以找到真实的 SerialDatastore 使用示例here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-15
      • 1970-01-01
      • 2023-01-12
      • 2017-03-15
      相关资源
      最近更新 更多