Custom Feature Generation in OpenNLP Namefinder API

Viewed 1920

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 Answers
Related