build_tools.nltk_syllable_extractor.batch ========================================= .. py:module:: build_tools.nltk_syllable_extractor.batch .. autoapi-nested-parse:: Batch mode for the NLTK syllable extractor. This module provides batch processing functionality for extracting syllables from multiple files using NLTK's CMU Pronouncing Dictionary. Functions --------- .. autoapisummary:: build_tools.nltk_syllable_extractor.batch.process_single_file build_tools.nltk_syllable_extractor.batch.process_batch build_tools.nltk_syllable_extractor.batch.run_batch Module Contents --------------- .. py:function:: process_single_file(input_path, min_len, max_len, output_dir, run_timestamp, verbose = False) Process a single file in batch mode with comprehensive error handling. This function attempts to extract syllables from a single file and saves the results. Unlike interactive mode, this function catches all exceptions and returns a result object indicating success or failure, allowing batch processing to continue even when individual files fail. :param input_path: Path to the input text file to process :param min_len: Minimum syllable length to include in results :param max_len: Maximum syllable length to include in results :param output_dir: Directory where output files should be saved :param run_timestamp: Timestamp for the batch run (shared across all files in batch) :param verbose: If True, print detailed progress messages (default: False) :returns: FileProcessingResult object with success status, syllables count, output paths (if successful), or error message (if failed). .. note:: This function never raises exceptions. All errors are caught and returned in the FileProcessingResult.error_message field. .. py:function:: process_batch(files, min_len, max_len, output_dir, quiet = False, verbose = False) Process multiple files sequentially in batch mode. This is a backwards-compatible wrapper around run_batch_extraction. :param files: List of input file paths to process :param min_len: Minimum syllable length to include :param max_len: Maximum syllable length to include :param output_dir: Output directory for all results (created if needed) :param quiet: If True, suppress all output except errors (default: False) :param verbose: If True, show detailed progress for each file (default: False). :returns: BatchResult with overall statistics and individual file results. .. py:function:: run_batch(args) Batch mode entry point for the NLTK syllable extractor CLI. This function processes multiple files based on command-line arguments, providing progress indicators and comprehensive error reporting. :param args: Parsed command-line arguments from argparse.Namespace containing: - file: Single file path (optional) - files: List of file paths (optional) - source: Directory path for scanning (optional) - pattern: File pattern for directory scanning (default: "*.txt") - recursive: Whether to scan directories recursively - min: Minimum syllable length (default: 1) - max: Maximum syllable length (default: 999) - output: Output directory (default: _working/output/) - quiet: Suppress progress indicators - verbose: Show detailed processing information Exit Codes: 0: All files processed successfully 1: One or more files failed to process :raises SystemExit: On validation errors or processing completion