Jeff Zemerick created OPENNLP-1546:
--------------------------------------

             Summary: NER training code example in documentation needs updated
                 Key: OPENNLP-1546
                 URL: https://issues.apache.org/jira/browse/OPENNLP-1546
             Project: OpenNLP
          Issue Type: Task
          Components: Documentation
            Reporter: Jeff Zemerick


The NER training code example needs updated.

[https://opennlp.apache.org/docs/1.8.2/manual/opennlp.html#tools.namefind.training.api]
 * The `TokenNameFinderFactory nameFinderFactory` part won't compile.
 * This code might be outdated in general.

 
{code:java}
ObjectStream<String> lineStream =
                new PlainTextByLineStream(new 
FileInputStream("en-ner-person.train"), StandardCharsets.UTF8);

TokenNameFinderModel model;

try (ObjectStream<NameSample> sampleStream = new 
NameSampleDataStream(lineStream)) {
  model = NameFinderME.train("en", "person", sampleStream, 
TrainingParameters.defaultParams(),
            TokenNameFinderFactory nameFinderFactory);
}

try (modelOut = new BufferedOutputStream(new FileOutputStream(modelFile)){
  model.serialize(modelOut);
}
                         {code}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to