Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Remove redundant file outputs in transcription process #10

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions transcribe_me/audio/transcription.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,42 +99,6 @@ def transcribe_with_assemblyai(
# Write additional information to separate files
base_name = os.path.splitext(output_path)[0]

# Speaker Diarization
with open(f"{base_name}_speakers.txt", "w", encoding="utf-8") as file:
for utterance in transcript.utterances:
file.write(f"Speaker {utterance.speaker}: {utterance.text}\n")
# Summary
with open(f"{base_name}_summary.txt", "w", encoding="utf-8") as file:
file.write(transcript.summary)

# Sentiment Analysis
with open(f"{base_name}_sentiment.txt", "w", encoding="utf-8") as file:
for result in transcript.sentiment_analysis:
file.write(f"Text: {result.text}\n")
file.write(f"Sentiment: {result.sentiment}\n")
file.write(f"Confidence: {result.confidence}\n")
file.write(f"Timestamp: {result.start} - {result.end}\n\n")

# Topic Detection
if transcript.iab_categories:
with open(f"{base_name}_topics.txt", "w", encoding="utf-8") as file:
# Detailed results
file.write("Detailed Topic Results:\n")
for result in transcript.iab_categories.results:
file.write(f"Text: {result.text}\n")
file.write(
f"Timestamp: {result.timestamp.start} - {result.timestamp.end}\n"
)
for label in result.labels:
file.write(f" {label.label} (Relevance: {label.relevance})\n")
file.write("\n")

# Summary of all topics
file.write("\nTopic Summary:\n")
for topic, relevance in transcript.iab_categories.summary.items():
file.write(f"Audio is {relevance * 100:.2f}% relevant to {topic}\n")


def process_audio_files(
input_folder: str, output_folder: str, config: Dict[str, Any]
) -> None:
Expand Down
Loading