How hyeonsangjeon/computing-korean-stt-error-rates works
Overall Project Identification
• Project Type: A Python utility library.
• Purpose: To compute similarity metrics (CER, WER, CRR) for evaluating ASR outputs against ground truth transcripts, particularly handling Korean language text.
• Key Use Cases: Evaluating ASR systems using metrics, preprocessing text (e.g., removing whitespace and punctuation), and generating error rate reports.
File Structure
• Top-Level Files/Folders:
• The root includes configuration files (.gitignore, LICENSE, setup.py, requirements.txt) and documentation (README.md).
• The main package is in the “nlptutti” directory, containing the core implementation of the metrics (e.g., asr_metrics.py and __init__.py).
• The “test” directory contains test scripts that validate the functionality of the package.
• Architectural Insights:
• The structure follows a typical Python library format, separating core library code from tests.
• The setup.py and requirements.txt indicate the packaging and dependency management, which are important for installation and integration contexts.
a. Main Components:
• Client Interface: Represents the functions that an end-user or another system will call (e.g., get_cer, get_wer).
• Core Library (nlptutti package):
• asr_metrics module: Contains the logic for computing error rates (CER, WER, CRR) using the Levenshtein algorithm.
• __init__.py: Manages package exports.
• Test Suite:
• Test files (e.g., nlptest.py, test_er.py) which verify algorithm correctness.
• External Dependencies:
• References to external packages as listed in requirements.txt.
• Integration with package distribution (setup.py) that ensures the package can be installed via pip.
• Documentation/Assets:
• README.md & image files from the “pic” directory that provide usage examples and algorithm illustration.
b. Relationships/Interactions:
• The Client calls the functions provided by the nlptutti package.
• The core functions from asr_metrics process inputs using internal algorithms (incorporating preprocessing steps like removing whitespace and punctuation).
• Tests interact with the core functions by providing various input strings and validating the computed error rates.
• Setup and dependency management files ensure that during the build/deployment, all necessary dependencies are included.
c. Architectural Patterns/Design Principles:
• Modularity: Separation between the core functionality (ASR metric calculations) and tests.
• Reusability and Extensibility: Well-defined functions (like get_cer, get_wer) allow for easy integration into different ASR evaluation pipelines.
• Clarity in API design: The package abstracts complex error computation details behind simple function interfaces.
d. Relevant Technologies/Frameworks:
• Python (as the primary language).
• Standard libraries for string manipulation and algorithm implementation, possibly using dynamic programming for Levenshtein distance.
• Packaging tools (setup.py, requirements.txt) to aid distribution through PyPI.