Skip to main content

Lao OCR Evaluation Tool with CER/WER and visual alignment

Project description

Lao Text Evaluation 🧪🇱🇦

Grapheme-aware evaluation toolkit for Lao OCR or text models — including CER, WER, character-level error breakdowns, and alignment visualizations.


✨ Features

  • ✅ Character Error Rate (CER) and Word Error Rate (WER)
  • ✅ Grapheme-level alignment using Unicode-aware splitting
  • ✅ Lao-specific character classification: consonants, vowels, tone marks
  • ✅ Visual alignment plots (color-coded matches, insertions, deletions, substitutions)
  • ✅ CLI interface for single or batch file comparison
  • ✅ Export results to CSV
  • ✅ Generate sample data for quick testing

🛠 Installation

pip install lao-text-evaluation

🚀 CLI Usage

🔹 Generate Sample Data

Quickly create example ground truth and prediction files for testing:

python -m lao_text_evaluation.cli --generate-sample-data
  • This will create sample/data/gt and sample/data/pred folders with example .txt files.

🔹 Single Pair Evaluation

python -m lao_text_evaluation.cli \
    --gt "ນ້ຳໃຈ" \
    --pred "ນ້ຳໃສ່" \
    --filename "sample1" \
    --plot \
    --plot-dir ./plots

🔹 Batch Folder Mode

python -m lao_text_evaluation.cli \
    --gt-path sample/data/gt \
    --pred-path sample/data/pred \
    --plot-sample 5 \
    --plot-dir ./plots \
    --save-csv results.csv \
    --append-csv
  • .txt files must match by filename between ground truth and predictions.
  • Plot images (optional) will be saved to --plot-dir.

🧪 Output Example

  • ✅ CSV format: Filename, CER, WER, Removed_*, Inserted_*, Replaced Graphemes
  • 🖼️ Visual plot: character alignment with color-coded errors

🧩 Module Usage (Python API)

from lao_text_evaluation.metrics import compute_cer, analyze_grapheme_errors
compute_cer("ນ້ຳໃຈ", "ນ້ຳໃສ່")

📂 Folder Structure

lao_text_evaluation/
├── metrics.py
├── utils.py
├── plotting.py
├── config.py
├── cli.py

📜 License

MIT License © 2025 Khonepaseuth Sounakhen

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lao_text_evaluation-0.1.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lao_text_evaluation-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file lao_text_evaluation-0.1.1.tar.gz.

File metadata

  • Download URL: lao_text_evaluation-0.1.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.8

File hashes

Hashes for lao_text_evaluation-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b8fd73fde82c2e6d642bf506f7a491c610ed4a46ff0615f0c08d7e887d3a7541
MD5 c0a316a2e3845944b70a2879547230d0
BLAKE2b-256 8d5ed4c873c94fc5d737e3f13655714f47e950bb7ad928d1ab2d22da732883a6

See more details on using hashes here.

File details

Details for the file lao_text_evaluation-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for lao_text_evaluation-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82ff583bafcc7e67c13b57764d3038259e2e07b0a83d8151eade3eead2e4cd42
MD5 d2735f53734507fd27e0215ef2157600
BLAKE2b-256 a65b1ea4f2fb82cb534c12dc8deb111a445a030fea56f0c7d4699f0208f2e07f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page