Word search

Supported languages

Word search is supported for all languages

You can search through a completed transcript for a specific set of keywords, which is useful for quickly finding relevant information.

The parameter can be a list of words, numbers, or phrases up to five words.

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()
9
10transcript = aai.Transcriber(config=config).transcribe(audio_file)
11
12if transcript.status == "error":
13 raise RuntimeError(f"Transcription failed: {transcript.error}")
14
15# Set the words you want to search for
16words = ["foo", "bar", "foo bar", "42"]
17
18matches = transcript.word_search(words)
19
20for match in matches:
21 print(f"Found '{match.text}' {match.count} times in the transcript")