build_tools.pyphen_syllable_extractor.cli

Command-line interface for the pyphen syllable extractor.

This module provides the CLI entry point and argument parser for the pyphen-based syllable extractor. The actual processing logic is in:

  • interactive.py - Interactive mode with language selection

  • batch.py - Batch mode for processing multiple files

Usage:

# Interactive mode (no arguments)
python -m build_tools.pyphen_syllable_extractor

# Batch mode (with arguments)
python -m build_tools.pyphen_syllable_extractor --file input.txt
python -m build_tools.pyphen_syllable_extractor --source ~/corpus/ --recursive

Attributes

main_batch

main_interactive

process_single_file_batch

Functions

create_argument_parser()

Create and configure the argument parser for batch mode.

main([args])

Main entry point for the pyphen syllable extractor CLI.

Module Contents

build_tools.pyphen_syllable_extractor.cli.main_batch
build_tools.pyphen_syllable_extractor.cli.main_interactive
build_tools.pyphen_syllable_extractor.cli.process_single_file_batch
build_tools.pyphen_syllable_extractor.cli.create_argument_parser()[source]

Create and configure the argument parser for batch mode.

This function sets up the argparse parser with all command-line options for batch processing mode. The parser supports mutually exclusive groups for input specification and language selection.

Returns:

Configured ArgumentParser instance ready to parse sys.argv.

Return type:

argparse.ArgumentParser

Example

>>> parser = create_argument_parser()
>>> args = parser.parse_args(["--file", "input.txt", "--lang", "en_US"])
>>> print(args.file)
PosixPath('input.txt')
build_tools.pyphen_syllable_extractor.cli.main(args=None)[source]

Main entry point for the pyphen syllable extractor CLI.

This function determines whether to run in interactive or batch mode based on the presence of command-line arguments.

Parameters:

args (list[str] | None) – Command-line arguments. If None, uses sys.argv.

Returns:

Exit code (0 for success, non-zero for error).

Return type:

int

Modes:
  • Interactive Mode: No arguments provided. Prompts user for all settings.

  • Batch Mode: Arguments provided. Processes files based on CLI flags.

Examples

Interactive mode (no arguments):

$ python -m build_tools.pyphen_syllable_extractor

Batch mode (with arguments):

$ python -m build_tools.pyphen_syllable_extractor --file input.txt --lang en_US
$ python -m build_tools.pyphen_syllable_extractor --files *.txt --auto
$ python -m build_tools.pyphen_syllable_extractor --source ~/docs/ --recursive --auto