You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@opennlp.apache.org by "Jeff Zemerick (Jira)" <ji...@apache.org> on 2024/03/20 19:56:00 UTC

[jira] [Created] (OPENNLP-1546) NER training code example in documentation needs updated

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)