Hi Vincent,

OpenNLP will take care of serializing the information necessary to call
your custom factory instead of the default one.
Just to make sure of that, change your custom POSContextGenerator by adding
a small log message. You should see the message both during training and
runtime.

To train, use the methods that you can pass in your custom factory.

-- William

2017-01-05 13:53 GMT-02:00 Vincent <[email protected]>:

> Hi all,
>
> I would like to be able to have a bit more influence on the features used
> for POS-tagging. I suppose that feature selection happens in the
> POSContextGenerator. However, I can't seem to be able to change the type of
> POSContextGenerator that is being called from POSTaggerFactory: the
> getPOSContextGenerator() function always returns the
> DefaultPOSContextGenerator.
>
> Looking for a way to make a custom POSContextGenerator work, I made a
> custom POSTaggerFactory too, that inherits from the regular
> POSTaggerFactory, but returns my own POSContextGenerator. However, for
> example, a class like POSModel (in turn used by POSTaggerME) is final, and
> can't be inherited from to use my custom POSTaggerFactory.
>
> It seems I just need to copy the entire code into my own project, or is
> there a better way to make this work?
>
> Thanks in advance!
>
> Cheers,
>
> Vincent
>
>

Reply via email to