build_tools.nltk_syllable_extractor.cli ======================================= .. py:module:: build_tools.nltk_syllable_extractor.cli .. autoapi-nested-parse:: Command-line interface for the NLTK syllable extractor. This module provides the CLI entry point and argument parser for the NLTK-based syllable extractor. The actual processing logic is in: - ``interactive.py`` - Interactive mode for single-file extraction - ``batch.py`` - Batch mode for processing multiple files Note: This extractor only supports English (CMUDict limitation). Usage:: # Interactive mode (no arguments) python -m build_tools.nltk_syllable_extractor # Batch mode (with arguments) python -m build_tools.nltk_syllable_extractor --file input.txt python -m build_tools.nltk_syllable_extractor --source ~/corpus/ --recursive Attributes ---------- .. autoapisummary:: build_tools.nltk_syllable_extractor.cli.main_batch build_tools.nltk_syllable_extractor.cli.main_interactive build_tools.nltk_syllable_extractor.cli.process_single_file_batch Functions --------- .. autoapisummary:: build_tools.nltk_syllable_extractor.cli.create_argument_parser build_tools.nltk_syllable_extractor.cli.main Module Contents --------------- .. py:data:: main_batch .. py:data:: main_interactive .. py:data:: process_single_file_batch .. py:function:: create_argument_parser() 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. :returns: Configured ArgumentParser instance ready to parse sys.argv. .. admonition:: Example >>> parser = create_argument_parser() >>> args = parser.parse_args(["--file", "input.txt"]) >>> print(args.file) PosixPath('input.txt') .. py:function:: main(args = None) Main entry point for the NLTK syllable extractor CLI. This function determines whether to run in interactive or batch mode based on the presence of command-line arguments. :param args: Command-line arguments. If None, uses sys.argv. :returns: Exit code (0 for success, non-zero for error). Modes: - Interactive Mode: No arguments provided. Prompts user for all settings. - Batch Mode: Arguments provided. Processes files based on CLI flags. .. admonition:: Examples Interactive mode (no arguments):: $ python -m build_tools.nltk_syllable_extractor Batch mode (with arguments):: $ python -m build_tools.nltk_syllable_extractor --file input.txt $ python -m build_tools.nltk_syllable_extractor --files *.txt $ python -m build_tools.nltk_syllable_extractor --source ~/docs/ --recursive