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.2.1.tar.gz (7.3 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.2.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lao_text_evaluation-0.2.1.tar.gz
  • Upload date:
  • Size: 7.3 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.2.1.tar.gz
Algorithm Hash digest
SHA256 313735dc35d5978fdde42d0818c37982555a5b7812f380802c1ac6b0092a628d
MD5 da55a10f024bfedf7585902078d98b5e
BLAKE2b-256 fcde301b31834d3984318e32fccfcc626de67e952282e7e9ff41884719c0a3c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lao_text_evaluation-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef78688285d4d467a802df2a3716c84ffd3fdaa13b6964babb9747fdd81985e2
MD5 a3e8d4ce077a62c4c1cc8792009e09f1
BLAKE2b-256 8290c667839f5287b50314d743754536ec7316028b6cf2825d27513be0b780f6

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