intoRootGazetteer的重新初始化方法无效

时间:2016-11-26 04:40:44

标签: nlp stanford-nlp gate

我是GATE NLP的新手。我正在开发一个适用于GATE NLP的应用程序。 所以,我已经创建了一个管道,我只在应用程序中通过创建singleton对象加载它一次。所以,由于这种应用程序的性能有所提高,但是当我在本体或地名词典中进行任何更改并重新运行应用程序时,它不会考虑新添加的单词,因为我通过我的加载我的管道使我的对象单例,所以它考虑以前加载的地名词典和本体论。所以, 我使用下面的代码使用它,它采用更新的地名词典,但不是本体。

  application = CorpusControllerSingleton.getInstance(gapFilePath).getApplicationObject();
            Iterator<ProcessingResource> it = application.getPRs().iterator();
if(isReload){
                System.out.println("processing resources------>"+it.next());
                while(it.hasNext()){
                    ProcessingResource pr = it.next();
                    if(pr.getName().equals("RzCIS") || pr.getName().equals("RzCs")) {
                        System.out.println("PR initialization--->" +pr.getFeatures());
                        pr.reInit();
                    }
                }

            }

有谁能解释我如何重新启动本体?

1 个答案:

答案 0 :(得分:1)

我使用了gazetteerInst因此,它的参数OntoRootGazetteer只是处理资源OntoRootGazetteer。首先,您需要获取正在管道中使用的所有处理资源。迭代它并从中提取OntoRootGazetteer。之后gazetterInst的属性ontology的值为实际值reinit。因此,您只需更新该本体或为其提供本体的路径。然后使用从ontoRootGazettter中提取的flexibleGazettteer application = CorpusControllerSingleton.getInstance(gapFilePath).getApplicationObject(); Iterator<ProcessingResource> it = application.getPRs().iterator(); while (it.hasNext()) { ProcessingResource pr = it.next(); if(pr.getName().equals(FLEXIBLE_GAZETTEER)){ onto_Root_gazetteer = (ProcessingResource) pr.getParameterValue(ONTOROOT_PROPERTY); onto_Root_gazetteer.setParameterValue(ONTOROOT_PARAMETER, OntoLoader.getInstance().getOntology()); onto_Root_gazetteer.init(); } if(pr.getName().equals(ANNIE_GAZETTEER_CASEINSENSITIVE)) { pr.reInit(); } if(pr.getName().equals(ANNIE_GAZETTEER_CASESENSITIVE)) { pr.reInit(); } } 方法。

通过编码 -

private static final String ONTOROOT_PROPERTY = "gazetteerInst";
private static final String ONTOROOT_PARAMETER = "ontology";

这里

PHP Warning:  PHP Startup: solr: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20121212
These options need to match in Unknown on line 0

使用此功能,将解决您的问题。