Skip to content

Numbers as digits in transcripts (inverse text normalization)

The problem. Speech models write numbers as words: “one thousand three hundred fifty five dollars twenty eight cents”. Your application needs $1,355.28 to show an order, fill a form or check a payment. With numerals, the transcript arrives with digits.

Where it works. Every model.

Live APInumerals
Pre-recorded (batch)numerals (how)
Live modelssolaria-3 (every live model)
LanguagesEvery language of the model (supported languages)

Numbers as digits are on by default on a live session, wherever your cluster offers them: a session that omits numerals gets them, except with "finals": "endpointing", where every final goes out at the pause. Set it explicitly to pick a region, or to turn it on or off:

{ "numerals": true }
{ "numerals": false }

false keeps the numbers as the speaker said them, in words. A final that ends on an amount the speaker is still saying can come a moment later with numbers as digits, so that the amount arrives whole: a voice agent that needs every final as early as possible can send false.

Each program streams a 16-bit WAV file and prints what comes back. Put your API key in the GLADIA_API_KEY environment variable, then run python numerals.py meeting.wav.

numerals.py
# pip install -U "gladiaio-sdk>=2.2"
import os
import sys
import threading
import wave
from gladiaio_sdk import GladiaClient
API_URL = os.environ.get("GLADIA_API_URL", "https://eu1.api.gladia.io")
API_KEY = os.environ["GLADIA_API_KEY"]
with wave.open(sys.argv[1]) as wav: # a 16-bit PCM WAV file
rate, channels = wav.getframerate(), wav.getnchannels()
audio = wav.readframes(wav.getnframes())
config = {
"encoding": "wav/pcm",
"sample_rate": rate,
"bit_depth": 16,
"channels": channels,
"model": "solaria-3",
"language_config": {
"languages": [
"en"
]
},
"numerals": True
}
client = GladiaClient(api_key=API_KEY, api_url=API_URL)
# `numerals`: Gladia Connect, not in the SDK's types: a dict is sent as is.
session = client.live_v2().start_session(config)
ended, errors = threading.Event(), []
@session.on("message")
def on_message(message):
if message.type == "transcript" and message.data.is_final:
print(message.data.utterance.text)
session.on("error", errors.append)
session.once("ended", lambda _: ended.set())
# Stream once the socket is open: a stop sent while it opens can pass the audio queued until then.
connected = threading.Event()
session.once("connected", lambda _: connected.set())
session.once("ended", lambda _: connected.set()) # a session that never connects ends
session.on("error", lambda _: connected.set())
if session.status == "connected": # it opened before the listener above
connected.set()
if not connected.wait(timeout=30) or errors or ended.is_set():
sys.exit(1) # no open session to stream to
step = rate * channels * 2 // 10 # 100 ms of audio per chunk
for start in range(0, len(audio), step):
session.send_audio(audio[start : start + step]) # live audio: send each chunk as it is captured
session.stop_recording()
ended.wait(timeout=60)
sys.exit(1 if errors or not ended.is_set() else 0)
{
"type": "transcript",
"data": {
"is_final": true,
"utterance": {
"text": "The total is $1,355.28 for 42 items.",
"text_raw": "The total is one thousand three hundred fifty five dollars twenty eight cents for forty two items."
}
}
}

text has the digits; text_raw keeps the words as spoken.

spoken written
“forty two” 42
“one thousand three hundred fifty five dollars twenty eight cents” $1,355.28
“mille trois cent cinquante-cinq euros vingt-huit” (French) 1 355,28 €
“the price is at two fifty dollars” the price is at $2.50
“twelve fifty euros please” €12.50 please
“call me at nine fifteen” call me at 9:15
“rendez-vous à neuf heures quinze” (French) rendez-vous à 9h15
“um halb zehn” (German) um 9:30
“a las nueve y cuarto” (Spanish) a las 9:15
“five to six thousand people” 5000 to 6000 people
“cinco o seis mil personas” (Spanish) 5000 o 6000 personas
“un budget de vingt-cinq trente mille euros” (French) un budget de 25 000-30 000 €
“fifteen percent” 15%
“quinze pour cent” (French) 15 %
“three, two, one, go” 3, 2, 1, go

Clock times are written the way the language writes them, with no extra setting.

A range said without “to” (“vingt-cinq trente mille euros”) is written as a range when its two bounds follow each other (“two three thousand”) or are round (“fifteen twenty million”); other pairs keep two numbers (“at nine fifteen thousand” is at 9 15000), and so does a pair with a comma between (“vingt-cinq, trente mille” is a list).

A price said as two numbers is one amount: “it costs nine ninety-nine dollars” becomes it costs $9.99. With no currency named, English takes the currency from the session language or region: “it costs two fifty” becomes $2.50, with region GB £2.50 and with IN ₹2.50; a region whose currency is not known leaves the digits apart (2 50). What is not a price keeps its reading: “meet at two fifty” is meet at 2:50, “nine forty minutes ago” is 9 40 minutes ago, “two fifty pounds of flour” is 2 50 pounds of flour, and “nine fifty people” is 950 people.

“un”, “one”, “uno”, “ein” are a number in one sentence and an article or a pronoun in the next. The whole sentence decides which: an article stays a word, a count becomes digits. A count or a duration of one said with its word stays a word too, the way it reads best in a sentence.

spoken written
“j’ai un client et un deux pièces à louer” (French) j'ai un client et un 2 pièces à louer
“press one, one of them will answer” press 1, one of them will answer
“ça coûte un euro” (French) ça coûte 1 €
“il y a un an” (French) il y a un an
“so ein, zwei Stunden” (German) so 1, 2 Stunden

With "turn_router": false, an article that also means “one” stays a word, in every language: “Omkring et minut senere” (Danish) stays as said, and so do “eine Minute”, “un año” and “un euro”. It becomes a digit next to another number (“vingt et un” is 21), in an amount that goes on (“un euro cinquante” is 1,50 €) and before a percent.

Phone numbers are written in their country’s format and dates the way the language writes them. Nothing to add: "numerals": true is enough wherever the model supports turn_router (on by default), and your messages keep their shape (no label is added to the finals).

spoken written
“zéro six douze trente-quatre cinquante-six soixante-dix-huit” (French) 06 12 34 56 78
“two one two five five five zero one two three” (212) 555-0123
“plus thirty three six twelve thirty four fifty six seventy eight” +33 6 12 34 56 78
“march twelfth twenty twenty six” March 12, 2026
“march twelfth twenty twenty six” (with "region": "GB") 12 March 2026
“le douze mars deux mille vingt-six” (French) le 12 mars 2026
“am zwölften märz” (German) am 12. März
“el primero de mayo” (Spanish) el 1 de mayo
“il primo maggio” (Italian) il 1º maggio

What you get. Each number of a final is written for what it is in its sentence (an amount, a phone number, a date, a clock time, a count):

  • a phone number the speaker has finished is written in the national format of its country. A spoken country code (“plus thirty three”) gives the international format. A number that no country’s numbering plan knows stays as digits;
  • a phone number still being dictated keeps its digits as said, the pauses’ commas removed: it is formatted once the speaker has given all of it;
  • a date is written the language’s way (English, French, German, Spanish, Italian, Portuguese, Dutch);
  • a clock time, a date, a rank or a phone number is never written as an amount.

With "turn_router": false (or on a host that does not run it), numerals writes numbers, clock times and amounts only: phone numbers and dates stay as plain digits. Digits alone cannot tell a phone number from an order number, an account number or a code, and formatting those as phone numbers would change them.

Phone numbers and dates follow a country. Set it with region, an ISO 3166-1 alpha-2 code in capitals:

{ "numerals": { "region": "CH" } }
region “zéro six douze trente-quatre cinquante-six soixante-dix-huit”
omitted (French) 06 12 34 56 78
CH 061 234 56 78

Without region, the countries where the language is spoken apply, in this order: English US, GB, CA, AU, IE, NZ, IN, ZA; French FR, BE, CH, CA, LU; German DE, AT, CH; Spanish ES, MX, AR, CO, CL, PE; Italian IT, CH; Portuguese PT, BR; Dutch NL, BE. A phone number is formatted for the first of these countries whose numbering plan knows it as dialled. A region that is not two capital letters is refused with a 400.

In English, a UK vehicle registration said letter by letter is written the way it is printed on the plate: two letters, two digits, a space, three letters. Nothing to add: "numerals": true is enough, with or without the turn router.

spoken written
“my registration is A B one two C D E” my registration is AB12 CDE
“it is a b twelve, c d e” it is AB12 CDE
“alpha bravo zero five charlie delta echo” AB05 CDE

Only that exact shape is joined: seven pieces said as one code, with no other letter or digit said right before or after them. A list or a new sentence of the same shape (“take vitamins A, B twelve, C, D, E”) stays apart. An acronym followed by a number (“the NHS 12 report”), a longer or shorter code, a phone number and the registrations of other countries (“AB-123-CD”) stay as they are. In another language the letters stay apart. A registration the model already wrote in one piece, in capitals (“AB12CDE”), gets its space: AB12 CDE. Letters the DVLA never issues (I, Q or Z in the first two, I or Q in the last three) are no registration: “A B one two C D I think” keeps its “I”.

A pre-recorded (batch) job takes the same option, on by default there too, wherever your cluster offers it; "numerals": false keeps the numbers in words. The transcript, its words, sentences and subtitles get the same digits a live session writes for the same words, each number timed from the words it was said with (Numbers as digits on a pre-recorded job). Phone numbers and dates stay as plain digits there, as live with "turn_router": false; numerals_config.region is accepted and changes nothing yet.

  • The conventions of the language spoken. Amounts take that language’s separators and currency position: set the language (language_config.languages) when you know it, or the detected one applies.
  • Partials too. Partial transcripts show digits as well, and may change while the number is still being said. Phone numbers and dates are formatted in the final transcripts only.
  • Phone numbers and dates need turn_router. It is on by default; with "turn_router": false they stay as plain digits.
  • Numbers said in pieces. “my card is 4970… 1234…” stays in one utterance with the number hold, under a finals policy that waits for it ("finals": "sentence" or a turn policy): with finals omitted, each piece comes as its own final, as with turn_router: false.
  • Vocabulary is kept. A custom vocabulary phrase made of number words (“Seven Eleven”) stays as you listed it.
  • Search and storage. Store text for display and text_raw if you match on spoken words.
  • Callsigns look like registrations. A radio or aviation callsign of the same shape, such as “golf alpha one two bravo charlie delta”, is written GA12 BCD too. text_raw keeps the words as spoken.
  • With PII redaction, numbers that are personal data (card, phone, account numbers) are redacted after the conversion.
symptom cause fix
amounts use the wrong separators another language was detected set language_config.languages
a long number is split over several finals turn_router: false, or a pause over 2 s keep the number hold on
a product name with numbers was converted it is not in your vocabulary add it to custom vocabulary
a phone number or a date stays as plain digits "turn_router": false remove "turn_router": false
a phone number is in another country’s format the language’s first country was used set numerals.region
a phone number stays as digits with turn_router on no country’s numbering plan knows it as dialled, or the speaker had not finished it check the digits and numerals.region