Skip to content

Example Analysis

Example 1 - Three Speaker Podcast

In the following example we analyse a podcast with three speakers. The audio file is pulled from an S3 bucket and the speaker mapping is provided. We ask the Conversations package to transcribe, diarise, summarise and generate an interactive HTML version of the transcription. To view the html version of the transcript click on the blue button below.

podcast_example.py
# Description: Example of using the Conversation class to analyse a podcast
from pathlib import Path
from conversations import Conversation
import pooch

# Properties of the conversation
cloud_file = "https://project-test-data-public.s3.amazonaws.com/test_audio.m4a"
speaker_mapping = {"0": "Alice", "1": "Bob", "2": "Sam"}

# Download audio file
audio_file = pooch.retrieve(
    url=cloud_file,
    known_hash="md5:77d8b60c54dffbb74d48c4a65cd59591",
    fname="podcast.m4a"
)

# Process the conversation
conversation = Conversation(recording=Path(audio_file),
                            num_speakers=3,
                            speaker_mapping=speaker_mapping)
conversation.transcribe(model="openai.en")
conversation.diarise()
conversation.save()

# Generate an interactive HTML version of the conversation
html_report = conversation.report(audio_file=cloud_file)
with open('conversation.html', 'w') as f:
    f.write(html_report.render())

# Generate a text file of the conversation
text_report = conversation.export_text()
with open('conversation.txt', 'w') as f:
    f.write(text_report)

# Generate a text file summarising the conversation
summary = conversation.summarise()
print(summary)

Interactive HTML Report

# Summary:
# In the meeting, Alice, Sam and Bob discuss the financial state of
# businesses, the challenges of companies going private, and the
# evolution of private equity firms' return expectations. They
# also touch on the industry's early risk-taking nature. Bob
# mentions historical deals as examples of the early risk-taking
# nature of private equity firms.
# 
# Key Points:
# 1. Challenges of companies going private
#    Alice: "Challenges of companies going private, especially in
#    terms of cutting expenses and finding new ways to pay
#    employees who were previously compensated with stocks."
# 2. Private equity firms' return expectations
#    Sam: "What are private equity firms' return expectations
#    when purchasing a company?"
# 3. Evolution of the private equity industry
#    Bob: "The industry has evolved over time, with early private
#    equity firms taking on riskier ventures,
#    similar to venture capitalists."
# ...
# 
# Action Items:
# None discussed in the meeting.
# 
# 20 Keywords (most to least relevant):
# 1. Financial state
# 2. Business
# 3. Operating cash flow
# ...
# 
# 10 Concepts/Themes (most to least relevant):
# 1. Financial challenges
# 2. Going private
# 3. Private equity
# ...
# 
# Most unexpected aspect of the conversation:
# The most unexpected aspect of the conversation was the mention of
# historical deals like RJR Nabisco and TWA Airlines as examples
# of the early risk-taking nature of private equity firms.
# 
# Concepts/Topics explained in the transcript:
# 1. Private equity firms' return expectations:
#    Bob explains that the industry has evolved over time,
#    with early private equity firms taking on riskier ventures,
#    similar to venture capitalists. No inaccuracies were identified.
# 
# Tone of the conversation:
# Overall tone: Informative and analytical
# Alice's tone: Concerned and analytical
# Bob's tone: Informative and explanatory
# Sam's tone: Inquisitive