For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
PlaygroundChangelogSign In
OverviewAPI ReferencePre-recorded STTStreaming STTVoice AgentsSpeech UnderstandingGuardrailsLLM GatewayFAQ
OverviewAPI ReferencePre-recorded STTStreaming STTVoice AgentsSpeech UnderstandingGuardrailsLLM GatewayFAQ
  • Getting started
    • Transcribe a pre-recorded audio file
    • Model selection
    • View model benchmarks
    • Evaluate model accuracy
    • Cloud endpoints & data residency
    • Manage concurrent requests
    • Webhooks
  • Models
    • Medical Mode
  • Features
    • Boost specific terms
    • Label speakers
    • Transcribe multiple audio channels
    • Transcribe audio with mixed languages
    • Correct spelling of terms
    • Include filler words
    • Search for words in transcript
    • Set the start and end of the transcript
  • Guides
LogoLogo
PlaygroundChangelogSign In
Features

Word Search

Was this page helpful?
Previous

Set the Start and End of the Transcript

Next
Built with
Supported Languages, Regions, and Models

Word search is supported for all languages, regions, and models.

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