Package org.coordinatekit.crf.annotator
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 entriesT- the tag type
- Enclosing class:
RetokenizeReviewer<F,T extends Comparable<T>>
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 Summary
Modifier and TypeMethodDescriptionalignmentStrategy(@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.build()Builds the reviewer.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.Sets the CRF tagger used to suggest tags when re-tagging a misaligned sequence.taggingInterface(TaggingInterface<F, T> taggingInterface) Sets the tagging interface used to present each misaligned sequence to the user.tagProvider(TagProvider<T> tagProvider) Sets the tag provider, whoseTagProvider.tags()set defines the tag space.terminal(org.jline.terminal.Terminal terminal) Sets the JLine terminal used to emit untokenizable warnings and the closing summary.Sets the tokenizer used to re-tokenize each sequence's surface.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.
-
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 benull; whennullthe 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, ornullto use the exact-match default- Returns:
- this builder
-
build
Builds the reviewer.- Returns:
- a new
RetokenizeReviewer - Throws:
IllegalStateException- iftagProvider,taggingInterface,terminal, ortokenizerhave not been set, or if the suppliedTagProvider.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 benull; whennull, 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, ornullto disable the feature display- Returns:
- this builder
-
tagger
Sets the CRF tagger used to suggest tags when re-tagging a misaligned sequence. May benull. When present, the tagger tokenizes the surface and its suggestions seed the presented tags; when absent, the configuredtokenizer(Tokenizer)splits the surface and every token starts atTagProvider.startingTag(). The tagger never affects alignment detection, which always uses the configured tokenizer.- Parameters:
tagger- the tagger, ornullto re-tag without suggestions- Returns:
- this builder
-
tagProvider
Sets the tag provider, whoseTagProvider.tags()set defines the tag space.- Parameters:
tagProvider- the tag provider- Returns:
- this builder
-
taggingInterface
Sets the tagging interface used to present each misaligned sequence to the user.- Parameters:
taggingInterface- the tagging interface- Returns:
- this builder
-
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
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 notaggeris 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 benull; whennulland ataggeris configured, the all-features view falls back to the tagger's embeddedfeatures. 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, ornullto use the tagger fallback (or no verbose display)- Returns:
- this builder
-