Calculate the Talk / Listen Ratio of Speakers
This guide will show you how to use AssemblyAI’s API to calculate the talk/listen ratio of speakers in a transcript. The following code uses the Python SDK.
Quickstart
Get started
Before we begin, make sure you have an AssemblyAI account and an API key. You can sign up for an AssemblyAI account and get your API key from your dashboard.
Step-by-Step Instructions
Install the SDK:
Import the assemblyai
package and set the API key.
Define a function called calculate_talk_listen_ratios
, which will calculate the talk-listen ratios for all speakers from a transcript with speaker labels. Speaker labels must be enabled for the ratios to be calculated.
Define a transcriber
, an audio_url
set to a link to the audio file (replace the example link that is provided with your own), and a TranscriptionConfig
with speaker_labels=True
. Then create a transcript which will be sent to the function calculate_talk_listen_ratios
and print out the results.
Example output when using the above sample audio file: