Skip to navigation

Get Names Right

View as Markdown

Speech recognition cannot know that your company is “Velqora” and a customer spells her name “Vyshnavi”. Tell Dictate the names of this recording and it writes them your way.

vocabularycontext.reference
What you sendA list of objects, one per name, such as {"word": "Sarvam"} (up to 1,000). A plain string is refused with 400Any document, up to 50,000 characters
Best forThe names that must be rightNames that are already in a record you have
sounds_likeYesNo

You can send both. When a term is in both, the vocabulary entry wins.

Send a vocabulary

import os
from sarvamai import SarvamAI
client = SarvamAI(api_subscription_key=os.environ["SARVAM_API_KEY"])
with open("support_note.wav", "rb") as f:
res = client.dictate.transcribe(
file=f,
language_code="en-IN",
vocabulary=[
{"word": "Velqora"},
{"word": "Velqora Fiber"},
{"word": "Vyshnavi Raghunathan"},
],
)
print(res.text)
for c in res.corrections:
print(f"{c.heard!r} -> {c.wrote!r} ({c.source})")
Output
Hi, this is Mira from Velqora Support. I spoke to Vyshnavi Raghunathan about her Velqora Fiber connection. Her router has shown a red light since Tuesday, so I raised a ticket and asked the field team to visit tomorrow morning.
'Belkora' -> 'Velqora' (vocabulary)
'Vaishnavi Raghunathan' -> 'Vyshnavi Raghunathan' (vocabulary)
'Belkora fiber' -> 'Velqora Fiber' (vocabulary)

corrections lists every change, so your app can show the user what changed. If recognition keeps writing a name wrong in the same way, copy that spelling from transcript into sounds_like:

sounds_like
{"word": "Taxoryn", "sounds_like": ["Taxorin"]}

Take the names from a document

When the names are already in a record (a meeting agenda, a CRM record, a prescription), send it as it is. No list to build.

AGENDA = """Orvinta launch sync, Friday
Attendees: Tejaswini Kulkarni (design), Farhan Siddiqui (payments)
Products: Orvinta, Orvinta Lite, Orvinta Max
Payment partner: Plivora checkout"""
with open("review_meeting.wav", "rb") as f:
res = client.dictate.transcribe(
file=f,
language_code="hi-IN",
mode="codemix",
context={"reference": AGENDA},
)
print(res.text)

Keep the list short and right

Send the names of this recording, not your catalogue. In testing, a list of 300 customer names fixed none of the three names in a recording. The same three names alone fixed all of them.

DoWhy
Send the names of this recording: this customer, this patient, this ticketA short list works much better than a large one
Write word exactly as it must appear in text, in the script of your modeEvery fix uses the listed spelling
List only the right spelling, not variantsA listed look-alike can replace a right name that was said
List each misheard form under one wordA second entry with a different word and the same sounds_like is refused with 400 (invalid_config on the socket) and names both entries. Case and surrounding spaces are ignored. Two entries with the same word are not refused, so list each name once
Write word as plain textIt is written exactly as sent, so a zero-width character or an emoji ends up in text. Spaces around it are trimmed
Read correctionsIt lists each change once per heard and wrote pair, not once per mention. The wrong ones are listed too
Check emails and URLs yourselfA term inside an email address or a URL is changed in text but not listed in corrections

vocabulary corrects words that recognition wrote. It cannot bring back a word that recognition lost. context.text (a sentence about the situation) can sometimes help, but it is not reliable for names and its changes are not listed in corrections. Use vocabulary or context.reference for names that must be right.