Interface DocumentAnnotator


public interface DocumentAnnotator
A pipeline step that reads layers from a Document and returns a new document with its own layers added.

An annotator declares the layers it requires() and provides(), so a DocumentAnalyzer can validate a pipeline before running it. Annotators are usually thin adapters over an existing analysis component. Thread safety is implementation specific.

Since:
3.0.0
  • Method Details

    • annotate

      Document annotate(Document document)
      Annotates a document.

      A required layer must be present on the document, but it may be empty: an empty required layer is valid input and yields the annotator's provided layers present but empty, so a pipeline degrades gracefully on documents without content.

      Parameters:
      document - The document to annotate. Must not be null and must contain every layer named by requires().
      Returns:
      A new Document carrying the layers named by provides() in addition to the input layers. Never null.
      Throws:
      IllegalArgumentException - Thrown if document is null or lacks a required layer.
    • requires

      default Set<LayerKey<?>> requires()
      Returns:
      The keys of the layers this annotator reads. Never null.
    • provides

      Set<LayerKey<?>> provides()
      Returns:
      The keys of the layers this annotator adds. Never null.