You tried to use the CachedFeatureGenerator, which is specific to the
NameFinder module.

I wrote a very simple example for you. It is compatible with OpenNLP
1.6.0-SNAPTSHOT (SVN trunk) or with the 1.6.0 RC2 (
http://comments.gmane.org/gmane.comp.apache.opennlp.devel/1161).

The example suggests using the Factory approach, which is more flexible and
safer. The model is compatible with the command line tools.

https://gist.github.com/wcolen/3d01e2949faad71256a0

Regards,
William

2015-02-18 11:16 GMT-02:00 Max Richter <[email protected]>:

> Hey William,
>
> thank you for your answer. I know have it running using the API.
> But it is somewhere a little criptic to me.
> This is what the example provides for the default generator:
>
> 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)
>        });
>
> I also found the discription of the single classes under:
>
> https://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/
>
> But do you have any real example of using the feature generator to get a
> better feeling how to use each class?
> This would be very helpful.
>
> Thank you!
> Max
>
> ----------------------------------------
> I did not found any option to reply to the mail in the archive so I post
> the mails here too, so that you can add it.
>
> Thanks, Max
>
> William Colen <[email protected]>
> Re: Custom Feature Generation with POS
> Fri, 13 Feb 2015 17:46:32 GMT
>
> > Hi, yes, there is are two possibilities. The easy way is using the API,
> > where you can pass the feature generator in the constructor of the
> trainer
> > and runtime. You must be careful to always use the same feature
> generator.
> > The other which is more flexible, is to create a custom factory that
> > provides the feature generator. This last option is only available in
> 1.5.3
> > or latter.
>
> > Regards,
> > William
>
> 2015-02-10 12:09 GMT-02:00 Max Richter <[email protected]>:
>
> > Hello,
> >
> > I would like to write my own feature generator which I want to use with
> > the openNLT POS-Tagger.
> > Is this in principle possible? Because in the documentation it was only
> > mentioned in context with the NER.
> >
> > Is there also some more detailed example on how to construct an custom
> > feature generator?
> >
> > Thank you for your help,
> > Max
> >
>

Reply via email to