Richard Zowalla created OPENNLP-1967:
----------------------------------------

             Summary: 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


{{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)

Reply via email to