krickert opened a new pull request, #1478: URL: https://github.com/apache/opennlp/pull/1478
The chunking and tree insert parsers can tag and chunk with a POSTagger and Chunker the application supplies, instead of the POSTaggerME and ChunkerME built from the tagger and chunker models in the ParserModel. Both parsers have a public constructor that takes a POSTagger and a Chunker next to the ParserModel. The build, attach and check models and the head rules come from the model; its tagger and chunker models are not used. The model-only constructors delegate to the new one. ParserFactory.builder(model) returns a ParserBuilder with tagger(), chunker(), beamSize() and advancePercentage(). build() picks the parser for the model's ParserType and builds the model's POSTaggerME and ChunkerME only for components that are not set. ParserFactory.create goes through the builder, so the type dispatch exists once. Arguments are checked at the public boundary with an IllegalArgumentException: a null model, tagger, chunker or head rules, a beam size below 1, and an advance percentage outside (0, 1]. The parser chapter of the manual shows the builder. Tests, for both parser types: a supplied tagger and chunker are called and give the same parse as the model's own, the tagger and chunker models of the ParserModel are not read, the builder defaults and an explicit beam size and advance percentage match ParserFactory.create, and every argument check rejects its bad input on the constructors and on the builder. Fixes #1476 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
