Class DocumentAnalyzer.Builder
java.lang.Object
opennlp.tools.document.DocumentAnalyzer.Builder
- Enclosing class:
DocumentAnalyzer
Assembles a
DocumentAnalyzer from annotators in execution order.- Since:
- 3.0.0
-
Method Summary
Modifier and TypeMethodDescriptionadd(DocumentAnnotator annotator) Appends an annotator to the pipeline.build()Validates the pipeline and builds the analyzer.
-
Method Details
-
add
Appends an annotator to the pipeline.- Parameters:
annotator- The annotator to run after the ones already added. Must not benull.- Returns:
- This
DocumentAnalyzer.Builder. Nevernull. - Throws:
IllegalArgumentException- Thrown ifannotatorisnull.
-
build
Validates the pipeline and builds the analyzer.- Returns:
- A
DocumentAnalyzer. Nevernull. - Throws:
IllegalArgumentException- Thrown if the pipeline is empty, an annotator requires a layer no earlier annotator provides, or two annotators provide the same layer.
-