Skip to content

Extracting Speaker Labels, Start/End Times, and Transcript Segments from Amazon Transcribe JSON output (Python)

0

Hi,

I'm using the Amazon Transcribe service with its Python API to convert audio to text. The transcript results come in JSON format. I'd like to extract specific information from the JSON, including:

Speaker labels (who is speaking) Start and end times for each speaker segment Transcript text for each speaker segment Can you advise on the proper method or Python code format to achieve this extraction?

asked 2 years ago464 views
1 Answer
0

Hi,

The simple and efficient way to parse json to a Python dict is to use json.load() function included in Python runtime: it does all the painful JSON parsing for you. You obtain a nice and clean Python dict in 1 single call.

See code samples at https://www.geeksforgeeks.org/json-load-in-python/

You have a Transcribe parser sample in Python at https://github.com/JeeZeh/winston/blob/main/transcribe.py

Best,

Didier

EXPERT
answered 2 years ago
  • I tried this code earlier but i am not able to extract the Transcript text for each speaker segment

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.