Class AnnotatorRunner
This is the home of the annotate invocation logic, separated from the picocli command
AnnotatorCommand (in the cli module). A caller that parses with its own
command-line framework builds an AnnotatorConfiguration and calls
run(AnnotatorConfiguration, AnnotatorFactory); this class performs the
interactive-terminal precondition and maps exit codes, but does no argument parsing and imports
no command-line parser. The shared terminal glue lives in TerminalSupport.
The interactive-terminal precondition rejects JLine "dumb" terminal types, which JLine returns
when stdin/stdout are not attached to a real TTY — as happens under CI scripts, piped input, or
nohup-style backgrounding. A non-interactive context is treated as a hard failure rather
than a silent write of garbage to the output XML.
Exit codes:
0— annotation completed;1— interactive-terminal precondition failed, the terminal could not be opened, orAnnotator.annotate(Path, Path)threw anIOException.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFactory that wires the typed beans (tag provider, tokenizer, feature extractor, optional CRF tagger) into anAnnotator. -
Method Summary
Modifier and TypeMethodDescriptionstatic intrun(AnnotatorConfiguration configuration, AnnotatorRunner.AnnotatorFactory factory) Opens an interactive system terminal and runs the annotator produced byfactory.
-
Method Details
-
run
public static int run(AnnotatorConfiguration configuration, AnnotatorRunner.AnnotatorFactory factory) Opens an interactive system terminal and runs the annotator produced byfactory. Returns a process exit code suitable forSystem.exit(int).- Parameters:
configuration- the parser-free annotate configurationfactory- the factory that constructs the annotator from the configuration and terminal- Returns:
- the process exit code
-