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.
At a glance
Section titled “At a glance”| Live API | numerals |
|---|---|
| Pre-recorded (batch) | numerals (how) |
| Live models | solaria-3 (every live model) |
| Languages | Every language of the model (supported languages) |
Step by step
Section titled “Step by step”1. Turn it on
Section titled “1. Turn it on”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.
2. Start a session with it
Section titled “2. Start a session with it”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.
# pip install -U "gladiaio-sdk>=2.2"import osimport sysimport threadingimport 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 endssession.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 chunkfor start in range(0, len(audio), step): session.send_audio(audio[start : start + step]) # live audio: send each chunk as it is capturedsession.stop_recording()
ended.wait(timeout=60)sys.exit(1 if errors or not ended.is_set() else 0)// npm install @gladiaio/sdkimport { readFileSync } from "node:fs";import { GladiaClient } from "@gladiaio/sdk";
const { sampleRate, channels, pcm } = readWav(process.argv[2]); // a 16-bit PCM WAV file
const config = { encoding: "wav/pcm", sample_rate: sampleRate, bit_depth: 16, channels, model: "solaria-3", language_config: { languages: [ "en" ] }, numerals: true};
const client = new GladiaClient({ apiKey: process.env.GLADIA_API_KEY, apiUrl: process.env.GLADIA_API_URL ?? "https://eu1.api.gladia.io",});// `numerals` is a Gladia Connect option not in the SDK's types: the SDK sends it as is.const session = client.liveV2().startSession(config);
session.on("message", (message) => { if (message.type === "transcript" && message.data.is_final) { const { text, text_raw } = message.data.utterance; console.log(text, text_raw ? `(spoken: ${text_raw})` : ""); }});session.on("error", (error) => { console.error(error); process.exitCode = 1;});session.once("ended", () => process.exit());
const step = (sampleRate * channels * 2) / 10; // 100 ms of audio per chunkfor (let start = 0; start < pcm.length; start += step) { session.sendAudio(pcm.subarray(start, start + step)); // live audio: send each chunk as it is captured}session.stopRecording();
function readWav(path) { const file = readFileSync(path); let fmt, pcm; for (let pos = 12; pos < file.length; ) { const id = file.toString("ascii", pos, pos + 4); const size = file.readUInt32LE(pos + 4); if (id === "fmt ") fmt = { channels: file.readUInt16LE(pos + 10), sampleRate: file.readUInt32LE(pos + 12) }; if (id === "data") pcm = file.subarray(pos + 8, pos + 8 + size); pos += 8 + size + (size % 2); } return { ...fmt, pcm };}Create the session, then stream its audio to the returned url (Live WebSocket):
curl -X POST https://eu1.api.gladia.io/v2/live \ -H "x-gladia-key: $GLADIA_API_KEY" \ -H "content-type: application/json" \ -d '{ "encoding": "wav/pcm", "sample_rate": 16000, "bit_depth": 16, "channels": 1, "model": "solaria-3", "language_config": { "languages": [ "en" ] }, "numerals": true }'3. Read the result
Section titled “3. Read the result”{ "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.
Words that are not always numbers
Section titled “Words that are not always numbers”“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 and dates
Section titled “Phone numbers and dates”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.
The country
Section titled “The country”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.
Vehicle registrations
Section titled “Vehicle registrations”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”.
On a pre-recorded job
Section titled “On a pre-recorded job”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.
Limits and gotchas
Section titled “Limits and gotchas”- 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": falsethey stay as plain digits. - Numbers said in pieces. “my card is 4970… 1234…” stays in one utterance with the number
hold, under a
finalspolicy that waits for it ("finals": "sentence"or a turn policy): withfinalsomitted, each piece comes as its own final, as withturn_router: false. - Vocabulary is kept. A custom vocabulary phrase made of number words (“Seven Eleven”) stays as you listed it.
- Search and storage. Store
textfor display andtext_rawif 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 BCDtoo.text_rawkeeps the words as spoken. - With PII redaction, numbers that are personal data (card, phone, account numbers) are redacted after the conversion.
Troubleshooting
Section titled “Troubleshooting”| 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 |