kdho
KDHO (Kök ve Ek Duyarlı Hata Oranı, Root- and Affix-Aware Error Rate) is a word error rate for Turkish speech recognition that understands morphology.
Turkish is agglutinative: one word carries a root and a chain of suffixes. WER counts evlerde → evlerden (one case suffix wrong) exactly like evlerde → okullarda (a different word) or geldi → gelmedi (meaning reversed). KDHO keeps the word as the unit, but prices each substitution with a morphological analysis of the two words:
| Case | Cost |
|---|---|
| identical words | 0 |
| different roots | 1 |
| negation differs (-mA, -(y)AmA, değil) | 1 |
| either word cannot be analyzed | 1 |
| same root, affix difference | λ · d_M (normalized edit distance between affix tags, λ = 0.5) |
Deletions and insertions cost 1 and the cost is used inside the alignment, so 0 ≤ KDHO ≤ WER always holds. All scores are error rates: lower is better.
Install
pip install kdho
Use
import kdho
kdho.kdho("ali eve geldi", "ali eve gelmedi") # 0.333 negation flip → full error
kdho.kdho("evlerde geldik", "evlerden geldik") # 0.125 one case suffix wrong → partial error
kdho.score(references, hypotheses) # corpus level
# {'kdho': 0.113, 'wer': 0.128, 'cer': 0.070, 'n_sentences': 5200, 'n_ref_words': 61234}
kdho.score(references, hypotheses, verbalize_numbers=True, return_details=True)
# digits spelled out on both sides (48 → kırk sekiz); 'ops' counts equal/affix/root/negation/oov/deletion/insertion
for step in kdho.explain("bu kitapları yarın okumayacağım", "bu kitabı yarın okuyacağım").steps:
print(step)
# ('equal', 'bu', 'bu', 0.0)
# ('affix', 'kitapları', 'kitabı', 0.25)
# ('equal', 'yarın', 'yarın', 0.0)
# ('negation', 'okumayacağım', 'okuyacağım', 1.0)
Command line
kdho explain "ali eve geldi" "ali eve gelmedi"
kdho score --ref refs.txt --hyp hyps.txt --numbers --details # one sentence per line
kdho score --jsonl outputs.jsonl --ref-key ref_norm --hyp-key hyp_norm
Options
| Argument | Default | Meaning |
|---|---|---|
lam |
0.5 | scale of the partial affix cost (0 = ignore affix errors, 1 = proportional full cost) |
normalize |
True | NFC, Turkish lowercasing (I→ı, İ→i), punctuation removal; word-internal apostrophes (Ankara'ya) kept |
verbalize_numbers |
False | spell out digits in Turkish: %50 → yüzde elli, 1990'da → bin dokuz yüz doksanda |
return_details |
False | add operation counts by type |
Helpers: kdho.normalize_text, kdho.turkish_lower, kdho.verbalize_numbers, kdho.number_to_words,
kdho.substitution_cost, kdho.analyze.
Validation
On a balanced Turkish test set (7 sources × 743 utterances, 14 open ASR models):
- Agreement with human meaning-change ratings (Spearman ρ, 48 pairs): KDHO 0.83, WER 0.75.
- Negation errors, 3 independent raters: agreement with the human ordering KDHO 78 %, CER 52 %.
- 72,800 system outputs: a negation error is ranked above a character-matched affix error 97 % of the time by KDHO, 67 % by CER.
Notes and limitations
- Morphological analysis uses Zeyrek 0.1.3 (pinned).
kdhofixes three issues of that version at import time: history-dependent analyses, a fakeUnkanalysis for unknown words, and unstable candidate order. Results are deterministic. - Analysis is context-free; spelling variants (olacak/olucak) and synonyms count as full errors.
- The first call downloads NLTK's
punkttokenizer if it is missing.
Citation
@misc{kdho2026,
title = {KDHO: A Root- and Affix-Aware Error Rate for Turkish Speech Recognition},
year = {2026},
note = {Under review}
}
License: Apache-2.0.
Metadata
Release files for kdho 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kdho-0.1.1.tar.gz | 15.3 kB | Without provenance | Details for kdho-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kdho-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for kdho-0.1.1-py3-none-any.whl |
Total release size: 30.1 kB
Release files / kdho-0.1.1.tar.gz
| Download URL | kdho-0.1.1.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22a4da9373d7f3240368691a4d5f8d734499cb0daf612caa6071efbb7ad3bb97
|
|
BLAKE2b-256 checksum How to use checksums |
be1629e7c576ac8f23aa174bba14a326a286f00dfe425d60149cde7fc9262fd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Release files / kdho-0.1.1-py3-none-any.whl
| Download URL | kdho-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ba4cac5d66bad25c912b87a8f76537dde0425b5d12d5f082b72630db3f25a0a
|
|
BLAKE2b-256 checksum How to use checksums |
6faa818cbc98d036f62b5d080992eb940c99abb1a3a5787fe6af50c745a23a91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Security for kdho 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.