Custom Spelling

Supported Languages, Regions, and Models

Custom Spelling is supported for all languages, regions, and models.

Custom Spelling lets you customize how words are spelled or formatted in the transcript.

To use Custom Spelling, pass a dictionary to set_custom_spelling() on the transcription config. Each key-value pair specifies a mapping from a word or phrase to a new spelling or format of a word. The key specifies the new spelling or format, and the corresponding value is the word or phrase you want to replace.

1import assemblyai as aai
2
3aai.settings.api_key = "<YOUR_API_KEY>"
4
5# audio_file = "./local_file.mp3"
6audio_file = "https://assembly.ai/wildfires.mp3"
7
8config = aai.TranscriptionConfig()
9config.set_custom_spelling(
10 {
11 "Gettleman": ["gettleman"],
12 "SQL": ["Sequel"],
13 }
14)
15
16transcript = aai.Transcriber(config=config).transcribe(audio_file)
17
18if transcript.status == "error":
19 raise RuntimeError(f"Transcription failed: {transcript.error}")
20
21print(transcript.text)

The value in the to key is case-sensitive, but the value in the from key isn’t. Additionally, the to key must only contain one word, while the from key can contain multiple words.