Class RetokenizeReviewer.Builder<F,T extends Comparable<T>>

java.lang.Object
org.coordinatekit.crf.annotator.RetokenizeReviewer.Builder<F,T>
Type Parameters:
F - the feature type carried by the tagger and the per-token entries
T - the tag type
Enclosing class:
RetokenizeReviewer<F,T extends Comparable<T>>

public static final class RetokenizeReviewer.Builder<F,T extends Comparable<T>> extends Object
Builder for RetokenizeReviewer.

tagProvider(TagProvider), taggingInterface(TaggingInterface), terminal(Terminal), and tokenizer(Tokenizer) are required. Unlike Annotator.Builder, the tokenizer is always required: it is the alignment-detection authority. A tagger is optional and supplies tag suggestions only.

  • Method Details

    • alignmentStrategy

      public RetokenizeReviewer.Builder<F,T> alignmentStrategy(@Nullable AlignmentStrategy alignmentStrategy)
      Sets the strategy used to compare a stored token list against the re-tokenized surface when deciding whether a sequence is aligned. May be null; when null the whole-list exact-match strategy (AlignmentModels.exactMatchStrategy()) is used, which treats a sequence as aligned only when the re-tokenization reproduces the stored tokens exactly.
      Parameters:
      alignmentStrategy - the comparison strategy, or null to use the exact-match default
      Returns:
      this builder
    • build

      public RetokenizeReviewer<F,T> build()
      Builds the reviewer.
      Returns:
      a new RetokenizeReviewer
      Throws:
      IllegalStateException - if tagProvider, taggingInterface, terminal, or tokenizer have not been set, or if the supplied TagProvider.tags() set is empty
    • featureExtractor

      public RetokenizeReviewer.Builder<F,T> featureExtractor(@Nullable FeatureExtractor<F> featureExtractor)
      Sets the feature extractor used to compute the key display features shown by the feature view of the tagging interface. May be null; when null, the key-feature view is not offered. The extracted features are presentational only — they have no effect on tagging or the written training data.
      Parameters:
      featureExtractor - the display feature extractor, or null to disable the feature display
      Returns:
      this builder
    • tagger

      public RetokenizeReviewer.Builder<F,T> tagger(@Nullable CrfTagger<F,T> tagger)
      Sets the CRF tagger used to suggest tags when re-tagging a misaligned sequence. May be null. When present, the tagger tokenizes the surface and its suggestions seed the presented tags; when absent, the configured tokenizer(Tokenizer) splits the surface and every token starts at TagProvider.startingTag(). The tagger never affects alignment detection, which always uses the configured tokenizer.
      Parameters:
      tagger - the tagger, or null to re-tag without suggestions
      Returns:
      this builder
    • tagProvider

      public RetokenizeReviewer.Builder<F,T> tagProvider(TagProvider<T> tagProvider)
      Sets the tag provider, whose TagProvider.tags() set defines the tag space.
      Parameters:
      tagProvider - the tag provider
      Returns:
      this builder
    • taggingInterface

      public RetokenizeReviewer.Builder<F,T> taggingInterface(TaggingInterface<F,T> taggingInterface)
      Sets the tagging interface used to present each misaligned sequence to the user.
      Parameters:
      taggingInterface - the tagging interface
      Returns:
      this builder
    • terminal

      public RetokenizeReviewer.Builder<F,T> terminal(org.jline.terminal.Terminal terminal)
      Sets the JLine terminal used to emit untokenizable warnings and the closing summary. Ownership is not transferred; the caller is responsible for closing it.
      Parameters:
      terminal - the terminal
      Returns:
      this builder
    • tokenizer

      public RetokenizeReviewer.Builder<F,T> tokenizer(Tokenizer tokenizer)
      Sets the tokenizer used to re-tokenize each sequence's surface. This is the alignment-detection authority — a sequence is misaligned when this tokenizer's output differs from the stored tokens — and it also splits surfaces for presentation when no tagger is configured. Required.
      Parameters:
      tokenizer - the tokenizer
      Returns:
      this builder
    • verboseFeatureExtractor

      public RetokenizeReviewer.Builder<F,T> verboseFeatureExtractor(@Nullable FeatureExtractor<F> verboseFeatureExtractor)
      Sets the feature extractor used to compute the verbose display features shown only by the all-features view of the tagging interface. May be null; when null and a tagger is configured, the all-features view falls back to the tagger's embedded features. Setting this extractor overrides that fallback. The extracted features are presentational only and have no effect on tagging or the written training data.
      Parameters:
      verboseFeatureExtractor - the verbose display feature extractor, or null to use the tagger fallback (or no verbose display)
      Returns:
      this builder