utils
Shared helpers for CLTK CLI commands.
BACKEND_CHOICES
module-attribute
HelpFormatter
Bases: RawDescriptionHelpFormatter
Help formatter with raw description support.
set_log_level
Adjust CLTK logger verbosity based on CLI flags.
Source code in cltk/cli/utils.py
parse_json_input
Parse a JSON string or JSON file path into a dict.
Source code in cltk/cli/utils.py
load_text
Load input text from flags or stdin.
Source code in cltk/cli/utils.py
parse_backends
Parse comma-separated backend list.
Source code in cltk/cli/utils.py
normalize_backend
Normalize and validate backend name.
Source code in cltk/cli/utils.py
resolve_pipeline
Resolve a pipeline class name from cltk.languages.pipelines.
Source code in cltk/cli/utils.py
build_cltk_config
build_cltk_config(
*,
language: str,
backend: str,
config: Optional[dict[str, Any]],
pipeline: Optional[Pipeline]
) -> CLTKConfig
Construct a CLTKConfig from CLI args and optional overrides.
Source code in cltk/cli/utils.py
feature_table_rows
Return column names and rows for a pyarrow-style table.
Source code in cltk/cli/utils.py
write_text_output
Write text to a file or stdout.
Source code in cltk/cli/utils.py
write_json_output
Write JSON to a file or stdout.
Source code in cltk/cli/utils.py
write_feature_table_csv
Write a feature table to CSV/TSV using stdlib csv.
Source code in cltk/cli/utils.py
require_parquet_deps
Return pandas and pyarrow modules or raise a clear error.
Source code in cltk/cli/utils.py
write_feature_table_parquet
Write a feature table to parquet using pandas + pyarrow.