Domain adaptation

Transcribing structured identifiers

Order codes, plates, IBANs, and SKUs.

Updated 23 September 20266 min readBy the Reson8 research team

Structured identifiers are codes such as order numbers, licence plates, IBANs, policy numbers and SKUs. They are among the hardest things for a speech recogniser to get right, because nothing about language helps: the characters are arbitrary, many letter names sound alike, and one wrong character makes the whole identifier useless. The most effective fixes tell the recogniser what format to expect and validate the result before anyone acts on it.

Key takeaways

  • A general language model has no useful prior over "INV7625X". Every character is decided by acoustics alone.
  • Letter names such as B, D, P, T and V differ by a single consonant, and telephone bandwidth removes much of the evidence that separates them.
  • Score identifiers by exact match or character error rate, not by WER over the whole utterance.
  • Supplying the expected format, for example a prefix and a digit count, gives the decoder the prior that language cannot.
  • Always validate: check digits, known-value lookups and read-back confirmation catch what recognition misses.

Why identifiers are hard#

For ordinary words, a speech recogniser combines what it hears with what is likely. "Recognise speech" is far more likely than "wreck a nice beach", and the language model resolves the ambiguity. Identifiers remove that second source of evidence. In "INV7625X", no character predicts the next, and the model has no way to prefer V over B except the sound.

The sound is often not enough:

  • Confusable letter names. In English, the E-set (B, C, D, E, G, P, T, V, Z) shares the vowel of "ee" and differs only in a short initial consonant. M and N, F and S, and A, H, J and K form similar clusters.
  • Narrowband audio. Telephone audio at 8 kHz cuts off frequencies above about 3.4 kHz, where much of the energy that distinguishes /s/ from /f/ lives.
  • Variable spoken forms. "Double seven", "seven seven", "seventy-seven" and "oh" for zero all appear in real calls. See numbers and alphanumerics.
  • Grouping and pauses. Callers read "WU53 TYN" as "W U fifty-three, T Y N" or "double-U U five three". The recogniser must reassemble the pieces.
  • Spelling alphabets. "B for Bravo" or "B as in boy" should yield B, not the word. The ICAO alphabet is common; national alphabets based on names are common too.

Even a strong general model will produce errors like these:

INV7625X vs INB seven six two five X

TZ94 FTH vs TC94FTH

Common identifier formats#

Many identifiers follow published standards. Knowing the structure lets you constrain and validate.

IdentifierExampleStructureBuilt-in check
IBAN (ISO 13616)NL91 ABNA 0417 1643 00Country code, 2 check digits, national account number; at most 34 charactersYes, MOD 97-10 (ISO 7064)
UK registration (current series)AB12 CDE2 letters, 2 age digits, 3 lettersNo
Dutch postcode1234 AB4 digits, 2 lettersNo
Payment card number16 digits typicalIssuer prefix, account digits, check digitYes, Luhn
Vehicle identification number (ISO 3779)17 charactersExcludes I, O and Q to avoid confusion with 1 and 0Position 9 in North America
Order, invoice, ticket numbersINV-000123Defined by each businessRarely

Constraining recognition with a format#

If the application knows an order number is "INV" followed by digits, that knowledge can enter recognition in one of three places.

After recognition#

Search the transcript for a span that nearly matches the format and snap it to the closest valid string. This is simple to build, but it works only on the single best transcript. If the recogniser wrote "INB", a post-processor has to guess whether B was really V.

During decoding#

Give the decoder the format so that hypotheses consistent with it are favoured while the audio evidence is still available. The recogniser compares "INB7625X" and "INV7625X" as candidates, and the format tips the balance toward the valid one. This is the identifier equivalent of context biasing, with a pattern in place of a word list.

Through the dialogue#

In a voice agent, ask for the identifier on its own turn, so the recogniser can treat the whole utterance as one code. Then read it back and ask for confirmation before calling a lookup tool.

Spoken Decoder candidates Constraint Output INB seven six two five X INB7625X INV7625X IMV7625X Format prior INV7625X prefix INV, then digits Acoustics alone cannot separate B from V. The expected format can.
Illustrative. Near-identical candidates differ in one confusable letter; knowledge of the format selects the valid one while the audio evidence is still in play.

Validating the result#

Recognition should never be the last line of defence for a value someone will act on. Where the identifier carries a check digit, verify it. Where a database of valid values exists, look it up. Where neither exists, confirm with the speaker.

import re

def iban_is_valid(iban: str) -> bool:
    s = iban.replace(" ", "").upper()
    if not re.fullmatch(r"[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}", s):
        return False
    rearranged = s[4:] + s[:4]
    digits = "".join(str(int(ch, 36)) for ch in rearranged)
    return int(digits) % 97 == 1

UK_PLATE = re.compile(r"[A-Z]{2}[0-9]{2} ?[A-Z]{3}")

print(iban_is_valid("NL91 ABNA 0417 1643 00"))    # True
print(bool(UK_PLATE.fullmatch("TZ94 FTH")))       # True
print(bool(UK_PLATE.fullmatch("TC94FTH")))        # True: format alone cannot catch this

The last line shows the limit of validation. "TC94FTH" is a well-formed plate; it is simply the wrong one. Format checks catch malformed output, not plausible substitutions, which is why constraining during recognition and confirming with the speaker both matter.

Measuring identifier accuracy#

A single wrong character in a ten-word utterance costs 10% WER, yet it makes the identifier 100% wrong for the business. Report identifier metrics separately:

  • Exact match rate: the share of identifiers transcribed with every character correct after normalising spaces and case. This is the number that predicts failed lookups.
  • Identifier WER or CER: error rate computed only over the identifier span. Useful for comparing systems when exact match rates are close.
  • Position of errors: errors clustered in one character class (E-set letters, 5 and 9, 15 and 50) point to specific fixes.

See entity and keyword accuracy for the general approach.

How Reson8 approaches this#

Reson8's Patterns feature lets you supply an expected identifier format, such as INV[0-9]{3}, and the model biases toward it during recognition. On Reson8's published evaluation, identifier WER on order numbers fell from 8.0% to 1.5% (81% relative), and on licence plates from 6.6% to 4.7% (29% relative). Example corrections include "INB seven six two five X" to INV7625X, "TC94FTH" to TZ94 FTH and "W53TYN" to WU53 TYN.

The smaller gain on plates reflects that a plate format constrains less than a fixed prefix does: many valid plates differ by one letter. Validation and confirmation remain good practice. Configuration is described in the documentation.

Common questions#

Why not just add every valid order number to a custom vocabulary?

For a few hundred values it can work. For millions, the list becomes a source of over-biasing and latency. A format describes the whole set compactly.

Does asking callers to use the NATO alphabet help?

Yes, when they comply. "Bravo" and "Victor" are acoustically distinct where B and V are not. The recogniser must map them back to letters, so test that it does.

Should identifiers be excluded from WER?

Keep them in overall WER, but report them separately as well. Aggregate WER hides identifier errors because identifiers are a small share of words.

What about identifiers that contain personal data?

IBANs, card numbers and national ID numbers are personal or payment data. Handle transcripts accordingly; see PII redaction.

References#

  1. ISO 13616-1:2020. Financial services: International bank account number (IBAN), Part 1: Structure of the IBAN. International Organization for Standardization.
  2. ISO/IEC 7064:2003. Information technology: Security techniques, Check character systems. International Organization for Standardization.
  3. ISO 3779:2009. Road vehicles: Vehicle identification number (VIN), Content and structure. International Organization for Standardization.
  4. ICAO. Annex 10 to the Convention on International Civil Aviation, Volume II: Communication Procedures (radiotelephony spelling alphabet).
  5. Peyser, C., Zhang, H., Sainath, T. N., & Wu, Z. (2019). Improving Performance of End-to-End ASR on Numeric Sequences. Interspeech.

Try Reson8 on your own audio

Speech recognition for European languages that adapts to your vocabulary from text, in under a minute. Free tier, EU-only processing.