Skip to main content

extended-wer-normalizer

jiwer-compatible text normalizer for Word Error Rate (WER) evaluation in voice AI.

Extends jiwer's built-in transforms with normalizations that matter for real-world ASR evaluation: phone numbers, emails, URLs, currency, percentages, ordinals, filler words, stuttering, and US/UK spelling variants.

Installation

pip install extended-wer-normalizer

Quick start

from extended_wer_normalizer import normalize_for_wer

normalize_for_wer("Call 0176 or email info@example.com, it costs $5.99")
# → "call 0 1 7 6 or email info at example dot com it costs 5 dollars 9 9 cents"

normalize_for_wer("Um, 1st place goes to Dr. Smith with 50% accuracy")
# → "first place goes to doctor smith with 5 0 percent accuracy"

Command line

The package installs an extended-wer-normalizer CLI (also runnable as python -m extended_wer_normalizer):

extended-wer-normalizer 'Call 0176 or email info@example.com'
# → call 0 1 7 6 or email info at example dot com

extended-wer-normalizer 'Hr. Müller, am 1. Januar' --language de
# → herr müller am erste januar

cat transcripts.txt | extended-wer-normalizer -l fr      # stdin, line by line
extended-wer-normalizer --file transcripts.txt -l fr > normalized.txt

extended-wer-normalizer --describe -l de                 # ordered transform list
extended-wer-normalizer --list-languages                 # de, en, fr

Exit codes: 0 success, 1 runtime error (e.g. unreadable file), 2 usage error (missing or conflicting inputs). Diagnostics go to stderr; stdout carries only normalized text, so the CLI composes with | diff, | wc -l, etc.

jiwer integration

Every normalization is a jiwer.AbstractTransform subclass — compose them freely:

import jiwer
from extended_wer_normalizer.transforms import NormalizeEmails, ExpandDigitRuns

pipeline = jiwer.Compose([
    NormalizeEmails(),
    ExpandDigitRuns(),
    jiwer.ToLowerCase(),
    jiwer.RemovePunctuation(),
    jiwer.ReduceToListOfListOfWords(),
])

wer = jiwer.wer("info at example dot com", "info@example.com", hypothesis_transform=pipeline)

Use the pre-built pipeline with jiwer.wer. The pipelines return strings, so append jiwer.ReduceToListOfListOfWords() — jiwer requires a transform that ends in word lists:

import jiwer
from extended_wer_normalizer import english_wer_pipeline

transform = jiwer.Compose([english_wer_pipeline, jiwer.ReduceToListOfListOfWords()])
wer = jiwer.wer(reference, hypothesis, reference_transform=transform, hypothesis_transform=transform)

Available transforms

Transform Example
CompoundSpokenNumbersToDigits "twenty one" → "21", "einundzwanzig" → "21" (with language="de")
ExpandDigitRuns "0176" → "0 1 7 6"
DigitWordsToChars "zero one seven" → "0 1 7"
NormalizeEmails "user@example.com" → "user at example dot com"
NormalizeURLs "https://example.com/path" → "example dot com"
NormalizeCurrency "$5.99" → "five dollars ninety nine cents"
NormalizePercentages "50%" → "fifty percent"
NormalizeOrdinals "1st" → "first", "15th" → "fifteenth"
ExpandAbbreviations "Dr." → "doctor", "vs." → "versus"
NormalizeSymbols "cats & dogs" → "cats and dogs"
SplitHyphenatedWords "fixed-term" → "fixed term"
NormalizeSpellingVariants "travelling" → "traveling", "colour" → "color" (British → American; English only)
RemoveFillerWords removes um, uh, hmm, er, ah, …
CollapseRepetitions "yes yes yes yes" → "yes" (collapses runs of 4+; configurable via max_repeats)
ExpandFrenchElisions "j'aime" → "j aime", "qu'il" → "qu il" (French only)

Every transform that consumes language-specific data accepts a language="en" keyword (default English): NormalizeEmails(language="fr"), ExpandAbbreviations(language="de"), etc.

Pipeline design

The English pipeline applies transforms left-to-right in a single pass:

  1. Pattern-specific (before punctuation is stripped): email, URL, symbol, abbreviation, currency, percentage, ordinal
  2. Core: contractions (I'm → i am), compound number words to digits (twenty one → 21), lowercase, intra-word hyphen split (fixed-term → fixed term), punctuation removal
  3. Spelling variants (English only): British → American (travelling → traveling)
  4. Digit normalization: expand digit runs (0176 → 0 1 7 6, 21 → 2 1), convert digit words (zero → 0)
  5. Cleanup: filler words, repetition collapse

Supported languages

Full pipelines (with language-specific abbreviations, fillers, lexicons, and number/ordinal/percentage word forms via num2words) ship for English, German, and French. Pass any other language value for the minimal fallback (lowercase, intra-word hyphen split, punctuation and whitespace cleanup, repetition collapse).

from extended_wer_normalizer import normalize_for_wer

# German: titles, fillers, ordinals, currency
normalize_for_wer("Hr. Müller, am 1. Januar, ähm, ungefähr 50% Rabatt", language="de")
# → "herr müller am erste januar ungefähr 5 0 prozent rabatt"

# French: elision contractions, ordinals, comma-decimal currency
normalize_for_wer("M. Dupont, le 1er janvier, c'est €5,99", language="fr")
# → "monsieur dupont le premier janvier c est 5 euros 9 9 centimes"

# Spanish, Italian, … fall through to the minimal pipeline
normalize_for_wer("¡Hola, mundo!", language="es")
# → "hola mundo"

# Tune the repetition-collapse threshold (default 3 → collapse runs of 4+)
normalize_for_wer("no no no", max_repeats=1)  # collapse any 2+ run
# → "no"

Per-language pipelines are also exposed for direct use with jiwer.wer:

from extended_wer_normalizer import (
    english_wer_pipeline,
    german_wer_pipeline,
    french_wer_pipeline,
)

To inspect or extend the language data:

from extended_wer_normalizer.languages import get_language_data, supported_languages

supported_languages()              # ["de", "en", "fr"]
get_language_data("de").abbreviations["hr."]  # "herr"

Quirks worth knowing

  • Currency and percentages canonicalize to digits, not words. NormalizeCurrency/NormalizePercentages first verbalize amounts ($5.99 → five dollars ninety nine cents, 50% → fifty percent — the per-transform outputs shown in the table above), but the digit-normalization stage (CompoundSpokenNumbersToDigits, then ExpandDigitRuns) runs later in the pipeline and converts those number words back to split digits: the pipeline's final form is 5 dollars 9 9 cents / 5 0 percent. Written and spoken forms still converge to the same string, which is what WER fairness needs — except for amounts with a trailing currency symbol (5,99 €), which are not yet recognized (ML-1801).
  • Hyphenated compounds: intra-word hyphens split into spaces (fixed-term → fixed term), so hyphenated and spaced spellings of the same words score identically. Before 0.6.0 the hyphen was deleted (fixedterm), which penalized STTs that never emit hyphens — WER numbers are not comparable across that boundary.
  • US/UK spelling variants: English canonicalizes British spellings to American (travelling → traveling, colour → color, centre → center), so dialect-only differences score zero. The 1,731-entry table is based on OpenAI Whisper's english.json (MIT) — the same table Gladia's normalizer ships — with a handful of documented corrections to entries that changed the word rather than only its spelling (upstream maps tonne → ton, philtre → filter) or that mapped American → British (see languages/en_spelling_variants.py). As with the hyphen change, WER numbers are not comparable across the boundary (introduced in 0.7.0).
  • Comma vs. period decimals: French uses , (€5,99, 3,5%); the currency and percentage transforms accept either separator regardless of language.
  • German ordinals: matched as 1- to 3-digit numbers followed by . and a word (e.g. "1. Januar" but not "Es war 1990." or "1.5 Liter"). 4+ digits and decimals are skipped to avoid false positives on years.
  • French ordinals: matched as 1er, 1ère, 2e, 2es, 2ème, 2èmes, 2nde, 2nds, 2nd. num2words returns masculine forms (premier, deuxième); feminine variants like première or seconde are not produced.
  • Contractions: jiwer.ExpandCommonEnglishContractions runs only for English. French has a custom ExpandFrenchElisions that splits j', l', d', n', s', m', t', c', qu', jusqu', lorsqu', puisqu', quoiqu' from the following word. German has no contraction step.
  • German pluralization: most currency units stay invariant (fünf Euro, not fünf Euros).

Metadata

Release files for extended-wer-normalizer 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for extended-wer-normalizer 0.7.0
File Size Uploaded Provenance Actions
extended_wer_normalizer-0.7.0.tar.gz 72.5 kB Without provenance Details for extended_wer_normalizer-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for extended-wer-normalizer 0.7.0
File Interpreter ABI Platform Actions
extended_wer_normalizer-0.7.0-py3-none-any.whl Python 3 none any Details for extended_wer_normalizer-0.7.0-py3-none-any.whl

Total release size: 106.8 kB

Release files / extended_wer_normalizer-0.7.0.tar.gz

Download URL extended_wer_normalizer-0.7.0.tar.gz
Size 72.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3f810b8031659c03b7ef8072c08ffbb6f05110fa64980107330e099615ed9551
BLAKE2b-256 checksum
How to use checksums
a460b937766a0d0f8111dbc09f0fafdd1d54c31b6840fff0c647b312a146a68a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / extended_wer_normalizer-0.7.0-py3-none-any.whl

Download URL extended_wer_normalizer-0.7.0-py3-none-any.whl
Size 34.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
391a1e1526bca4c033e1c94757d93113fcea2159d3f8c3c2e1a1a319a2be8f83
BLAKE2b-256 checksum
How to use checksums
8e7dfc0cfb53fafba9220ee43abe98860d1f4dddbbc4bd207788b51a641d6cd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for extended-wer-normalizer 0.7.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page