[
https://issues.apache.org/jira/browse/OPENNLP-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14165081#comment-14165081
]
Joern Kottmann commented on OPENNLP-718:
----------------------------------------
The name finder trainer doesn't require that the -factory parameter is
provided. As described here above there is a bug in the handling of the
TokenNameFinderFactory in that case.
If the -factory parameter is not provided. The call to
TokenNameFinderFactory.create(...) passes null for the class implementing the
factory. In that case a default factory (TokenNameFinderFactory) is created.
Up to here everything is good.
The problem is that the instance of the TokenNameFinderFactory is not
initialized via a call to its init method. The method is there so the logic
dealing with loading and instantiating an external class doesn't have to know
the signature of the constructor of a particular class.
Therefore the init method has to be called after the object was created.
The best would probably to change TokenNameFinderFactory.create so it has only
one return statement in the end, and calls the init method just in the line
before.
> TrainNameFinder CLI trains wiht default features if not -factory is provided
> ----------------------------------------------------------------------------
>
> Key: OPENNLP-718
> URL: https://issues.apache.org/jira/browse/OPENNLP-718
> Project: OpenNLP
> Issue Type: Bug
> Components: Name Finder
> Affects Versions: 1.6.0
> Reporter: Rodrigo Agerri
> Assignee: Rodrigo Agerri
> Fix For: 1.6.0
>
>
> The TrainNameFinder CLI requires to provide a -factory parameter when a
> feature generator is provided via the -featuregen parameter. If not -factory
> is provided, at the moment of creating the TokenNameFinderFactory in the
> TokenNameFinderTrainerTool class (line 207), the TokenNameFinderFactory is
> created with the default TokenNameFinderFactory() constructor. That means
> that the featureGenerator defaults to null and the
> TokenNameFinderFactory.createContext() provides the default context
> generator.
> I see several possible solutions:
> 1. Provide the TokenNameFinderFactory as a default subclass if not custom
> factory is added via -factory. This way it is not compulsory to provide a
> custom factory and the training process will take the feature generator
> provided by -featuregen.
> 2. Maintain current behaviour, e.g., training with default feature generator,
> but providing a warning so that the user can decide what to do.
> 3. Maintain current behaviour, but break with an exception advising to
> provide a factory.
> Maybe there are any others.
> Comments?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)