Skip to main content

Open-lattice Indic Word Error Rate (OIWER) with a fast Rust core

Project description

voi_oiwer

Open-lattice Indic Word Error Rate (OIWER) for ASR evaluation across Indian languages, with a fast Rust core.

Unlike plain WER, OIWER scores a hypothesis against a lattice of accepted reference variations per word/phrase, so legitimate spelling / transliteration variants aren't counted as errors.

Install

pip install voi_oiwer

Works on CPython 3.8+ (Linux, macOS, Windows). Prebuilt wheels — no Rust toolchain needed.

Usage

from voi_oiwer import oiwer

score, final_h, final_r, final_ops, (ins, dele, sub), \
    total_ref_words, metadata, std_refs = oiwer(
        hypothesis="नमस्ते दुनिया",
        reference_lists=[["नमस्ते"], ["दुनिया", "विश्व"]],   # lattice: variations per slot
        input_language="hindi",
    )

print(score)   # OIWER, as a percentage

Arguments

arg type description
hypothesis str the ASR output text
reference_lists list[list[str]] the reference lattice — one list of accepted variations per slot (a variation may be multiple words)
input_language str a language name, e.g. "hindi", "tamil", "urdu" (see list below)

Returns

A tuple:

(oiwer_score,                    # float — error percentage
 final_h,                        # list[str] — aligned hypothesis words
 final_r,                        # list[str] — aligned reference words (" " = insertion)
 final_ops,                      # list[str] — per slot: 'c' correct, 's' sub, 'd' del, 'i' ins
 (insertions, deletions, substitutions),
 total_reference_words,          # int
 final_metadata,                 # list — [lat_idx, var_idx, word_idx] per reference word (None for insertions)
 standardized_reference_lists)   # list[list[str]] — the normalized lattice used internally

Supported languages

assamese, bengali, bodo, dogri, gujarati, hindi, kannada, kashmiri, konkani, maithili, malayalam, manipuri, marathi, nepali, odia, punjabi, sanskrit, santali, sindhi, tamil, telugu, urdu, chattisgarhi, bhojpuri.

How it works

Text normalization (indicnlp-based) runs in Python; the edit-distance alignment over the lattice runs in a compiled Rust core — so results are identical to the reference implementation while running several times faster.

Development

pip install maturin
maturin develop --release   # build the Rust core into your active venv
pytest -q                   # run the test suite

License

MIT © JoshTalks

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

voi_oiwer-0.1.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distributions

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

voi_oiwer-0.1.0-cp38-abi3-win_amd64.whl (112.8 kB view details)

Uploaded CPython 3.8+Windows x86-64

voi_oiwer-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (222.9 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

voi_oiwer-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (219.7 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

voi_oiwer-0.1.0-cp38-abi3-macosx_11_0_arm64.whl (206.7 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

voi_oiwer-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl (213.5 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file voi_oiwer-0.1.0.tar.gz.

File metadata

  • Download URL: voi_oiwer-0.1.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for voi_oiwer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 189b08a5a9470043fe3be77a9afa86505284bb28fbdd79e8149c514afe932752
MD5 7c707eaed73d9fa65beed89a47fcf3d1
BLAKE2b-256 5b41e0b77ae602fd39d39c0fc4951c01e8e48a31547f7c6d08439e22ba407b25

See more details on using hashes here.

Provenance

The following attestation bundles were made for voi_oiwer-0.1.0.tar.gz:

Publisher: release.yml on JoshTalks/voi_oiwer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file voi_oiwer-0.1.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: voi_oiwer-0.1.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 112.8 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for voi_oiwer-0.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b2d472b00d11fc74037734c1013fb8f4b99aae0d3e37fca699041eb12b600629
MD5 f49b02520d67aaf627c72da2f41f23ed
BLAKE2b-256 9b5402c8cce12915b39fb6f8f7ded6eb5f72264ac9a58c9cd86abc2dcc84d207

See more details on using hashes here.

Provenance

The following attestation bundles were made for voi_oiwer-0.1.0-cp38-abi3-win_amd64.whl:

Publisher: release.yml on JoshTalks/voi_oiwer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file voi_oiwer-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for voi_oiwer-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 659836e933fda11fa5fa40c4fbf30133a824d65ee8ea74f80ed37fcffa6945af
MD5 83be9552e05f1765cb67314d87cbe32c
BLAKE2b-256 4359db9f052cd8e07d36da71a4563cbe9064aca535a03d4f1b4c4fdedea0b42a

See more details on using hashes here.

Provenance

The following attestation bundles were made for voi_oiwer-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on JoshTalks/voi_oiwer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file voi_oiwer-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for voi_oiwer-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cf620b3d0c9033fc6e12fd40fef51611f391b4f7616ebd8b33a65ceeaf3d8001
MD5 f002efc524694450f4cadba92052ff2f
BLAKE2b-256 202469dff07269e91446db17acce69eec693bcebcdb4abe09c091a67afce7912

See more details on using hashes here.

Provenance

The following attestation bundles were made for voi_oiwer-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on JoshTalks/voi_oiwer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file voi_oiwer-0.1.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for voi_oiwer-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dbdd9e9dd9ece7f81cd5d6853fa3736fdd0777127d9960fa9ef466c597b742ce
MD5 065d3a6bff0ef3fd29307135289b6b88
BLAKE2b-256 7da1222cec5f1d6855b71a21dbe66dd62bdeafe586447862d18e17ffa5efaa61

See more details on using hashes here.

Provenance

The following attestation bundles were made for voi_oiwer-0.1.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on JoshTalks/voi_oiwer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file voi_oiwer-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for voi_oiwer-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7a8b11127c9e49ccdedc4dadf37bd22a0363366637b7d23f195c539ef995687e
MD5 d82060a7404b4670082210aedf7ab98f
BLAKE2b-256 52dd6a75bcf5f59f661f457380299ff1f433aadcd0aaa6e47a956365ad455d67

See more details on using hashes here.

Provenance

The following attestation bundles were made for voi_oiwer-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on JoshTalks/voi_oiwer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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