function test_attendee_extraction
A test function that validates the attendee extraction logic of the EnhancedMeetingMinutesGenerator by parsing a meeting transcript and displaying extracted metadata including speakers, date, and duration.
/tf/active/vicechatdev/leexi/test_attendee_extraction.py
11 - 48
moderate
Purpose
This function serves as a unit test to verify that the EnhancedMeetingMinutesGenerator correctly extracts attendee information and other metadata from meeting transcripts. It loads a specific transcript file, parses it, and outputs the extracted information including meeting date, duration, speaker list, and a preview of the transcript content. This is useful for debugging and validating the metadata extraction functionality during development.
Source Code
def test_attendee_extraction():
"""Test the improved attendee extraction logic"""
# Initialize generator
generator = EnhancedMeetingMinutesGenerator(model='gpt-4o')
# Test with actual transcript
transcript_path = '/tf/active/leexi/leexi-20250618-transcript-development_team_meeting.md'
print("๐งช Testing improved attendee extraction...")
print(f"๐ Using transcript: {transcript_path}")
try:
# Load transcript
with open(transcript_path, 'r', encoding='utf-8') as f:
transcript = f.read()
# Extract metadata
metadata = generator.parse_transcript_metadata(transcript)
print(f"๐
Meeting Date: {metadata['date']}")
print(f"โฑ๏ธ Duration: {metadata['duration']}")
print(f"๐ฅ Actual Speakers Found: {len(metadata['speakers'])}")
print("๐ค Speaker List:")
for speaker in metadata['speakers']:
print(f" - {speaker}")
# Show first few lines of transcript for context
print("\n๐ First 10 lines of transcript for reference:")
lines = transcript.split('\n')[:10]
for i, line in enumerate(lines):
if line.strip():
print(f" {i+1}: {line[:80]}...")
except Exception as e:
print(f"โ Error: {e}")
import traceback
traceback.print_exc()
Return Value
This function does not return any value (implicitly returns None). It prints test results and metadata to stdout, including meeting date, duration, speaker count, speaker names, and the first 10 lines of the transcript. If an error occurs, it prints the error message and full traceback.
Dependencies
enhanced_meeting_minutes_generatortraceback
Required Imports
from enhanced_meeting_minutes_generator import EnhancedMeetingMinutesGenerator
import traceback
Conditional/Optional Imports
These imports are only needed under specific conditions:
import traceback
Condition: only used when an exception occurs during test execution
Required (conditional)Usage Example
# Direct execution of the test function
from enhanced_meeting_minutes_generator import EnhancedMeetingMinutesGenerator
import traceback
def test_attendee_extraction():
generator = EnhancedMeetingMinutesGenerator(model='gpt-4o')
transcript_path = '/tf/active/leexi/leexi-20250618-transcript-development_team_meeting.md'
try:
with open(transcript_path, 'r', encoding='utf-8') as f:
transcript = f.read()
metadata = generator.parse_transcript_metadata(transcript)
print(f"Meeting Date: {metadata['date']}")
print(f"Duration: {metadata['duration']}")
print(f"Speakers: {metadata['speakers']}")
except Exception as e:
print(f"Error: {e}")
traceback.print_exc()
# Run the test
test_attendee_extraction()
Best Practices
- Ensure the transcript file path exists and is accessible before running the test
- The hardcoded file path should be parameterized for better reusability across different environments
- Consider using pytest or unittest framework instead of standalone test functions for better test management
- Add assertions to validate expected outcomes rather than just printing results
- Handle file encoding issues gracefully, especially for transcripts with special characters
- The function assumes the EnhancedMeetingMinutesGenerator has a 'parse_transcript_metadata' method that returns a dictionary with 'date', 'duration', and 'speakers' keys
- Consider adding cleanup code in a finally block if the generator needs resource cleanup
- For production use, replace print statements with proper logging
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
function test_attendee_extraction_comprehensive 87.3% similar
-
function main_v27 65.4% similar
-
function test_mixed_previous_reports 63.5% similar
-
class MeetingMinutesGenerator 62.6% similar
-
function main_v14 59.8% similar