# hyeonsangjeon/computing-korean-stt-error-rates architecture

> Architecture diagram of the GitHub repository hyeonsangjeon/computing-korean-stt-error-rates, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hyeonsangjeon/computing-korean-stt-error-rates
- Repository: https://github.com/hyeonsangjeon/computing-korean-stt-error-rates

## Overview

##### 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.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Interface
    Client["Client Interface"]:::client

    %% Core Library (nlptutti Package)
    subgraph "nlptutti Package"
        API["API (__init__.py)"]:::core
        Metrics["Error Metric Computation (asr_metrics.py) - Preprocessing&Levenshtein"]:::core
        API -->|"calls"| Metrics
    end

    %% Setup and Dependencies
    subgraph "Setup/Dependencies"
        Setup["setup.py"]:::dependency
        Req["requirements.txt"]:::dependency
    end

    %% Documentation and Visual Assets
    subgraph "Documentation & Assets"
        Readme["README.md"]:::doc
        Pic["pic/"]:::doc
    end

    %% Test Suite
    subgraph "Test Suite"
        Test1["nlptest.py"]:::test
        Test2["test_er.py"]:::test
    end

    %% Relationships
    Client -->|"calls"| API
    Metrics -->|"returnsMetrics"| Client
    Metrics -->|"validatedBy"| Test1
    Metrics -->|"validatedBy"| Test2
    Setup --- API
    Setup --- Metrics
    Req --- API
    Req --- Metrics
    Readme --- Client
    Readme --- API
    Pic --- Readme

    %% Click Events
    click API "https://github.com/hyeonsangjeon/computing-korean-stt-error-rates/blob/main/nlptutti/__init__.py"
    click Metrics "https://github.com/hyeonsangjeon/computing-korean-stt-error-rates/blob/main/nlptutti/asr_metrics.py"
    click Test1 "https://github.com/hyeonsangjeon/computing-korean-stt-error-rates/blob/main/test/nlptest.py"
    click Test2 "https://github.com/hyeonsangjeon/computing-korean-stt-error-rates/blob/main/test/test_er.py"
    click Setup "https://github.com/hyeonsangjeon/computing-korean-stt-error-rates/blob/main/setup.py"
    click Req "https://github.com/hyeonsangjeon/computing-korean-stt-error-rates/blob/main/requirements.txt"
    click Readme "https://github.com/hyeonsangjeon/computing-korean-stt-error-rates/blob/main/README.md"
    click Pic "https://github.com/hyeonsangjeon/computing-korean-stt-error-rates/tree/main/pic/"

    %% Styles
    classDef client fill:#ffd1dc,stroke:#333,stroke-width:2px;
    classDef core fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef test fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef dependency fill:#fff3cd,stroke:#333,stroke-width:2px;
    classDef doc fill:#d1ecf1,stroke:#333,stroke-width:2px;
```
