On 9/30/11 12:23 AM, Riccardo Tasso wrote:
On 28/09/2011 12:55, Jörn Kottmann wrote:
One of the issues we have with "custom" resources is that we don't
yet have a generic mechanism to create them.
Lets say you store a custom dictionary, in your data format int he
model, then the model loading code needs to
know how to parse this dictionary with the custom dictionary class.
I sadly discovered what you mean after a whole day trying to implement
the POSDictionary interface! At least I learned a lot on the actual
implementation.
Do you think that to handle the customization of POSDictionary is
required a big re-organization of POSModel? Where would you start? I
have the time to help you in the development as I decided to base my
work on OpenNLP.
No, you need to sub-class it, and then at least override
createArtifactSerializers. There you register an Artifact Serializer
for your custom dictionary if it is based on a resource you want to
store in the model.
You then also need to overrride getTagDictionary to return your
instance, I guess we should change that so it returns a
TagDictionary and not a POSDictionary (please open a jira for that).
Hope that helps, don't hesitate to ask more questions.
To improve the situation we need to define a way to do this "custom"
resource loading in a more generic way,
e.g. placing a class name in a model. Maybe we should start to work on that.
Jörn