[
https://issues.apache.org/jira/browse/OPENNLP-1967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Richard Zowalla updated OPENNLP-1967:
-------------------------------------
Fix Version/s: 3.1.0
> Resolve trainers through providers and accept provider names in
> ExtensionLoader
> -------------------------------------------------------------------------------
>
> Key: OPENNLP-1967
> URL: https://issues.apache.org/jira/browse/OPENNLP-1967
> Project: OpenNLP
> Issue Type: Improvement
> Reporter: Richard Zowalla
> Priority: Major
> Labels: spi
> Fix For: 3.1.0
>
>
> {{TrainerFactory}} keeps a {{BUILTIN\_TRAINERS}} map filled with
> {{Class.forName}} from {{AlgorithmType}}, and for other values tries
> {{ExtensionLoader}} against {{EventTrainer}}, {{EventModelSequenceTrainer}}
> and {{SequenceTrainer}} until one does not throw.
> Sketch:
> \* {{ExtensionLoader.instantiateExtension\(spi, type, nameOrClass\)}}:
> resolves a provider by name, otherwise falls back to the class name and the
> package allow\-list.
> \* {{EventTrainerProvider}}, {{EventModelSequenceTrainerProvider}},
> {{SequenceTrainerProvider}}, named after the {{AlgorithmType}} values
> \({{MAXENT}}, {{MAXENT\_QN}}, {{PERCEPTRON}}, {{PERCEPTRON\_SEQUENCE}},
> {{NAIVEBAYES}}\).
> \* Each ML module registers its own trainers. {{BUILTIN\_TRAINERS}} and the
> probing are removed.
> \* {{AlgorithmType}} also names model reader and writer classes that
> {{GenericModelReader}} and {{GenericModelWriter}} load by name; the providers
> create those as well.
> \* A third\-party trainer registers a provider instead of being added to the
> allow\-list; its class name keeps working.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)