Custom Feature Generation in OpenNLP Namefinder API

北城以北 提交于 2019-12-10 13:32:00

问题


I am trying to use the Custom Feature generation of OpenNLP for Named Finder API.

http://opennlp.apache.org/documentation/1.5.3/manual/opennlp.html

I went through the documentation but I was not able to understand how to specify the different features.

It just says:

AdaptiveFeatureGenerator featureGenerator = new CachedFeatureGenerator(
     new AdaptiveFeatureGenerator[]{
       new WindowFeatureGenerator(new TokenFeatureGenerator(), 2, 2),
       new WindowFeatureGenerator(new TokenClassFeatureGenerator(true), 2, 2),
       new OutcomePriorFeatureGenerator(),
       new PreviousMapFeatureGenerator(),
       new BigramNameFeatureGenerator(),
       new SentenceFeatureGenerator(true, false)
       });

But how do you actually use each of these different feature generators to create my own custom features. Can somebody post a sample code defining these feature generators and how do we use it for custom feature generation. Thanks in anticipation.


回答1:


I did not find any documentation either, but for most feature generators the code is quite self explanatory. Here are some links to the source repository:

  • TokenFeatureGenerator
  • TokenClassFeatureGenerator
  • OutcomePriorFeatureGenerator
  • PreviousMapFeatureGenerator
  • SentenceFeatureGenerator
  • BigramNameFeatureGenerator
  • WindowFeatureGenerator
  • CachedFeatureGenerator

Furthermore, the documentation you refer to states that the quoted feature generator is similar to the default feature generator. However, the source code shows that it is actually identical to the default feature generator.



来源:https://stackoverflow.com/questions/11989633/custom-feature-generation-in-opennlp-namefinder-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!