|
|
|
import re |
|
from datetime import datetime, timedelta |
|
|
|
class MeetingAnalyzer: |
|
def __init__(self): |
|
self.transcript_chunks = [] |
|
self.action_items = [] |
|
self.decisions = [] |
|
|
|
def process_chunk(self, text_chunk): |
|
self.transcript_chunks.append(text_chunk) |
|
|
|
|
|
if "action item" in text_chunk.lower() or "todo" in text_chunk.lower(): |
|
self.action_items.append({ |
|
"task": text_chunk, |
|
"owner": "Unassigned", |
|
"deadline": "ASAP" |
|
}) |
|
|
|
def generate_summary(self): |
|
full_text = " ".join(self.transcript_chunks) |
|
|
|
|
|
if len(full_text.split()) < 50: |
|
return "Meeting in progress... summary will appear here" |
|
|
|
|
|
sentences = full_text.split('. ') |
|
return ". ".join(sentences[:3]) + "." |
|
|
|
def extract_action_items(self): |
|
|
|
action_items = [] |
|
|
|
|
|
patterns = [ |
|
r"(\bassign\b.*? to \b(.*?)\b)", |
|
r"(\baction item\b: (.*?))", |
|
r"(\btodo\b: (.*?))", |
|
r"(\bplease\b (.*?))" |
|
] |
|
|
|
for pattern in patterns: |
|
for match in re.finditer(pattern, " ".join(self.transcript_chunks), re.IGNORECASE): |
|
task = match.group(1).strip() |
|
action_items.append({ |
|
"task": task, |
|
"owner": "Unassigned", |
|
"deadline": "ASAP" |
|
}) |
|
|
|
return action_items |
|
|
|
def detect_urgent_action_items(self): |
|
urgent_items = [] |
|
for item in self.action_items: |
|
if "urgent" in item['task'].lower() or "asap" in item['task'].lower(): |
|
urgent_items.append(item) |
|
return urgent_items |
|
|
|
def extract_decisions(self): |
|
decisions = [] |
|
|
|
|
|
patterns = [ |
|
r"\bdecided to\b (.*?)[\.\n]", |
|
r"\bagreed that\b (.*?)[\.\n]", |
|
r"\bconsensus is\b (.*?)[\.\n]" |
|
] |
|
|
|
for pattern in patterns: |
|
for match in re.finditer(pattern, " ".join(self.transcript_chunks), re.IGNORECASE): |
|
decisions.append(match.group(1).strip()) |
|
|
|
return decisions |