首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我们需要在一个新的注释器中创建process()吗?

我们需要在一个新的注释器中创建process()吗?
EN

Stack Overflow用户
提问于 2013-06-04 15:42:00
回答 1查看 76关注 0票数 0

我正在创建一个名为"NewAnnotator“的注释器,并尝试让它与ClearTK中的其他注释器(如: SentenceAnnotator、PosTaggerAnnotator等)一起在流水线中工作。所以我希望能够运行流水线:

代码语言:javascript
复制
aggregate.add(SentenceAnnotator.getDescription());
aggregate.add(PosTaggerAnnotator.getDescription());
aggregate.add(NewAnnotator.getDescription());   
// run the classification pipeline on the new texts
SimplePipeline.runPipeline(reader, aggregate.createAggregateDescription());

我写的代码没有错误,但在运行它时返回了很多错误,我认为这是我的NewAnnotator代码中的这一部分:

代码语言:javascript
复制
  public static AnalysisEngineDescription getDescription() throws ResourceInitializationException {
    return AnalysisEngineFactory.createPrimitiveDescription(

          NewAnnotator.class,
          PARAM_POSTAG_MODEL_FILE,
          ParamUtil.getParameterValue(PARAM_POSTAG_MODEL_FILE,  "/somepath")); 
  }
  public static final String PARAM_POSTAG_MODEL_FILE = ConfigurationParameterFactory.createConfigurationParameterName(
      PosTaggerAnnotator.class,
      "postagModelFile");

我几乎从PosTaggerAnnotator复制了这一部分,但它在我的NewAnnotator中没有任何用处,我只是添加了它,以便我可以使用:

代码语言:javascript
复制
aggregate.add(NewAnnotator.getDescription());   

因为我不知道在没有.getDescription();的情况下添加到aggregate的任何其他方法,我也不知道如何在我的注释器中声明一个正确的getDescription(),即使没有它也可以很好地工作。所以,如果你经历过,请在这里给我一些建议!谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-04 18:39:25

getDescription()是一种为注释器创建默认描述的便捷方法。它使用AnalysisEngineFactory.createPrimitiveDescription(),您需要为其提供正确的参数,如下所示:

代码语言:javascript
复制
  public static AnalysisEngineDescription getDescription() throws ResourceInitializationException {
    return AnalysisEngineFactory.createPrimitiveDescription(
          NewAnnotator.class,
          first_parameter_name,  first_parameter_value, 
          second_parameter_name, second_parameter_value,
          ... ); 
  }

uimaFIT codebase中有更多的例子。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16912330

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档