Class RetokenizeReviewer<F,T extends Comparable<T>>
- Type Parameters:
F- the feature type carried by the tagger and the per-token entriesT- the tag type
A downstream tokenizer change can leave stored sequences tokenized under an old tokenizer that no
longer match what the new one produces. review(Path, Path) walks the input file in
document order and, for each TrainingSequence, reconstructs its
surface, re-tokenizes it with the configured
Tokenizer, and routes it by the AlignmentStatus an AlignmentDetector
reports:
ALIGNED— the stored tokenization still matches, so the sequence is copied through verbatim, preserving its tags and excluded runs.MISALIGNED— the sequence is freshly re-tokenized and presented through the configuredTaggingInterfacefor a human to re-tag. OnACCEPTthe re-tokenized tokens, the chosen tags, and the new excluded runs are written; onSKIPthe original (still-misaligned) sequence is kept; onEXITthis and every remaining sequence are copied through unchanged and review stops.UNTOKENIZABLE— the new tokenizer rejected the surface; the original sequence is copied through unchanged and a warning is emitted to the terminal.
The output contains exactly one sequence per input sequence, in document order. Review
never drops or reorders sequences; only accepted misaligned sequences differ from their input, so
unreviewed items remain a complete, valid dataset. Initial tags are always fresh —
model-suggested when a CrfTagger is configured, otherwise every token starts at
TagProvider.startingTag(); no old tags carry over.
Review is a fresh, single-pass rewrite: the output path must be absent or empty, and must differ
from the input path. There is no content-hash resume — that behavior belongs to
Annotator.
Tokenizer/tagger consistency. Alignment detection uses the standalone
Tokenizer, while presentation with a tagger uses CrfTagger.tag(String), which
re-tokenizes through the tagger's own tokenizer. These two must agree on how a surface splits;
the downstream factory that supplies both is responsible for wiring the same tokenizer into each,
as the annotate path already assumes.
Instances are constructed via the nested RetokenizeReviewer.Builder.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRetokenizeReviewer.Builder<F,T extends Comparable<T>> Builder forRetokenizeReviewer. -
Method Summary
Modifier and TypeMethodDescriptionstatic <F,T extends Comparable<T>>
RetokenizeReviewer.Builder<F, T> builder()Returns a new builder forRetokenizeReviewer.voidReviews the input file against the configured tokenizer, writing a complete corrected dataset to the output file.
-
Method Details
-
builder
Returns a new builder forRetokenizeReviewer.- Type Parameters:
F- the feature type carried by the tagger and the per-token entriesT- the tag type- Returns:
- a new builder with no values set
-
review
Reviews the input file against the configured tokenizer, writing a complete corrected dataset to the output file.Each input sequence is routed by its
AlignmentStatus: aligned and untokenizable sequences are copied through (the latter with a terminal warning), and misaligned sequences are presented through theTaggingInterfaceand rewritten onACCEPT, kept as stored onSKIP, or — onEXIT— copied through along with every remaining sequence before review stops. Every written sequence is flushed immediately. A one-line summary is written to the configuredTerminalwhen the pass completes.- Parameters:
inputFile- the XML training-data file to reviewoutputFile- the XML training-data file to write the corrected dataset to; must be absent or empty and must differ frominputFile- Throws:
ReviewPreconditionException- ifinputFileandoutputFileare the same path, oroutputFilealready exists and is non-emptyIOException- if reading the input or writing the output fails
-