Services and Apps Overview¶
CLI Applications (MAIN/ Directory)¶
FitzUICI Generator provides several command-line applications for document processing, each serving specific functions in the document workflow pipeline.
borders-cli¶
Purpose: Document preprocessing and OCR engine Main Functions: - Page cropping and margin removal from scanned images - PDF page-by-page processing with automatic/semi-automatic correction - OCR text extraction with confidence scoring - Perspective correction for distorted document scans
Key Features: - Dynamic double-page detection - Interactive debugging mode - Manual processing fallback for problematic pages - Tesseract OCR integration
Usage Patterns: - Single image cleanup: python MAIN/borders.py crop-page image.jpg - Batch PDF processing: python MAIN/borders.py fix-pdf document.pdf - Text extraction: python MAIN/borders.py ocr-pdf document.pdf
dir-automator-cli¶
Purpose: Batch directory document processing Main Functions: - Automated scanning of document directories - Sequential processing of multiple PDFs/DOCs - Integration with document splitting pipeline
Key Features: - Configurable processing parameters per dataset - Pause modes for quality control - LLM-assisted sectioning - Scanned PDF handling
Usage Patterns: - Whole-directory processing: python MAIN/dir_automator.py input_dir --split --data-name Subject2025
input-generator-cli¶
Purpose: YAML-driven input generation and processing Main Functions: - Parse complex YAML configurations - Generate processing inputs from templates - Schema validation and example generation
Key Features: - Interactive processing mode - Schema documentation generation - Template-based input creation
Usage Patterns: - Configuration processing: python MAIN/input_generator.py process config.yaml - Schema inspection: python MAIN/input_generator.py print-yaml-schema
manual-lens-app¶
Purpose: Interactive GUI application for manual document correction Main Functions: - Perspective transformation of skewed documents - Rotation adjustment with visual feedback - Manual cropping with point-and-click interface
Key Features: - Realtime preview of transformations - Tkinter-based GUI with intuitive controls - Synchronous/asynchronous processing modes
Usage Patterns: - Direct API call: from MAIN.manual_lens import process_sync; process_sync("input.jpg", "output.jpg") - Integrated fallback in automated processing
ml-doc-splitter-cli¶
Purpose: NLP-powered document structure analysis Main Functions: - Automatic section and chapter detection - Title consolidation and cleanup - LLM-enhanced preprocessing
Key Features: - Distinguishes between styled and plaintext documents - TOC (Table of Contents) filtering - Semantic redundancy removal - Multi-level filtering pipeline
Usage Patterns: - Single document analysis: python MAIN/ml_doc_splitter.py nlp-split document.docx
normalize-docs-cli¶
Purpose: Universal document format converter Main Functions: - TXT → DOCX conversion - PDF → DOCX conversion (via pdf2docx) - DOC/DOCX validation and normalization
Key Features: - Preserves original formatting where possible - Error handling for unsupported formats - Batch conversion capability
Usage Patterns: - Format standardization: python MAIN/normalize_docs.py any-to-docx input.txt
test.py¶
Purpose: Development/testing utilities for image processing algorithms Main Functions: - Line detection and vertical text region identification - OCR confidence analysis - Computer vision debugging tools
Key Features: - Algorithm prototyping space - Interactive visualization functions - Performance testing utilities
Note: This is a development utility, not a production application.
Integration Patterns¶
Automated Pipeline¶
Manual Workflow¶
OCR Processing¶
Dependencies and Runtime Requirements¶
All CLI applications use the pyt_utils.cli_utils.CLI framework for consistent argument parsing and help generation. Common dependencies include:
- OpenCV (computer vision)
- PyMuPDF (PDF processing)
- Tesseract (OCR)
- NLTK/Spacy (NLP)
- Tkinter (GUI components)
- PIL/Pillow (image handling)
External tools required: - Tesseract OCR binaries - LibreOffice (for DOC/DOCX conversions)
Error Handling¶
All applications implement consistent error handling: - CLI argument validation - File existence checks - Processing status reporting - Debug mode for troubleshooting - Skip/manual modes for problematic content
Performance Considerations¶
- Memory usage scales with document size and page count
- OCR processing is CPU-intensive
- GUI applications require display/X11 access
- Batch processing supports parallel execution patterns