Class RetokenizeRunner

java.lang.Object
org.coordinatekit.crf.annotator.RetokenizeRunner

@NullMarked public final class RetokenizeRunner extends Object
Parser-free invocation of the retokenize flow.

This is the peer of AnnotatorRunner for the retokenize flow: where AnnotatorRunner drives Annotator.annotate(Path, Path), this class drives RetokenizeReviewer.review(Path, Path). It is the home of the retokenize invocation logic, separated from the picocli command RetokenizeCommand (in the cli module). A caller that parses with its own command-line framework builds a RetokenizeConfiguration and calls run(RetokenizeConfiguration, ReviewerFactory); this class performs the interactive-terminal precondition, the fresh-pass precondition, and the exit-code mapping, but does no argument parsing and imports no command-line parser. The shared terminal glue lives in TerminalSupport.

The reviewerFactory wires the typed beans (tag provider, tokenizer, feature extractor, optional CRF tagger) into a RetokenizeReviewer, wiring the same tokenizer into both the reviewer and any CrfTagger, as RetokenizeReviewer's contract requires.

Exit codes:

  • 0 — review completed;
  • 1 — interactive-terminal precondition failed, the terminal could not be opened, the review's fresh-pass precondition was violated (input path equals output, or the output exists and is non-empty), or RetokenizeReviewer.review(Path, Path) threw an IOException.
  • Method Details

    • run

      public static int run(RetokenizeConfiguration configuration, RetokenizeRunner.ReviewerFactory factory)
      Opens an interactive system terminal and runs the reviewer produced by factory. Returns a process exit code suitable for System.exit(int).
      Parameters:
      configuration - the parser-free retokenize configuration
      factory - the factory that constructs the reviewer from the configuration and terminal
      Returns:
      the process exit code