Class DocumentAnalyzer
java.lang.Object
opennlp.tools.document.DocumentAnalyzer
Runs a fixed sequence of
annotators over a text, producing
one Document that carries every step's layers.
The pipeline is validated at build time: every annotator's required layers must be provided by an earlier annotator, and no two annotators may provide the same layer, so a misordered or conflicting pipeline fails when it is assembled rather than midway through a document. The analyzer holds no per-call state; it is as thread-safe as the annotators it is built from.
- Since:
- 3.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAssembles aDocumentAnalyzerfrom annotators in execution order. -
Method Summary
Modifier and TypeMethodDescriptionanalyze(CharSequence text) Analyzes a text by running every annotator in order.static DocumentAnalyzer.Builderbuilder()
-
Method Details
-
builder
- Returns:
- A new
DocumentAnalyzer.Builder. Nevernull.
-
analyze
Analyzes a text by running every annotator in order.- Parameters:
text- The original document text. Must not benull.- Returns:
- The annotated
Document. Nevernull. - Throws:
IllegalArgumentException- Thrown iftextisnull.
-