-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_analyzer.py
More file actions
86 lines (70 loc) · 2.88 KB
/
Copy pathtest_analyzer.py
File metadata and controls
86 lines (70 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
"""Quick test script for ConversationAnalyzer."""
import sys, os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from src.engines.conversation_analyzer import ConversationAnalyzer
print("=" * 60)
print("TEST 1: Original probleem - Stijn vraagt Pieter over API")
print("=" * 60)
ca = ConversationAnalyzer("/tmp/test_conv_a.db")
ca.record_message(456, "Stijn", "zit je op mijn api of niet?", "Danique")
ca.record_message(456, "Pieter", "uhh als het goed is wel", "Danique")
# Nu vraagt Stijn follow-up over API - dit is voor PIETER
r = ca.get_likely_target(456, "Stijn", "op welke api zit je dan", "Danique")
print(f"Target: {r['target']}")
print(f"Is Danique: {r['is_danique']}")
print(f"Confidence: {r['confidence']:.0%}")
print(f"Signals: {r['signals']}")
print(f"Scores: {r['scores']}")
print()
print("=" * 60)
print("TEST 2: Stijn noemt expliciet 'danique' - IS voor Danique")
print("=" * 60)
ca.record_message(456, "Stijn", "op welke api zit je dan", "Danique")
r2 = ca.get_likely_target(456, "Stijn", "ik vraag je op welke api je wel zit danique", "Danique")
print(f"Target: {r2['target']}")
print(f"Is Danique: {r2['is_danique']}")
print(f"Confidence: {r2['confidence']:.0%}")
print(f"Signals: {r2['signals']}")
print()
print("=" * 60)
print("TEST 3: Pieter naar Stijn - 'moet ik je centje overmaken'")
print("=" * 60)
ca.record_message(456, "Stijn", "ik vraag je op welke api je wel zit danique", "Danique")
r3 = ca.get_likely_target(456, "Pieter", "moet ik je centje overmaken", "Danique")
print(f"Target: {r3['target']}")
print(f"Is Danique: {r3['is_danique']}")
print(f"Confidence: {r3['confidence']:.0%}")
print(f"Signals: {r3['signals']}")
print()
print("=" * 60)
print("TEST 4: Iemand zegt 'hey danique hoe gaat het' - IS voor Danique")
print("=" * 60)
r4 = ca.get_likely_target(456, "Stijn", "hey danique hoe gaat het", "Danique")
print(f"Target: {r4['target']}")
print(f"Is Danique: {r4['is_danique']}")
print(f"Confidence: {r4['confidence']:.0%}")
print(f"Signals: {r4['signals']}")
print()
print("=" * 60)
print("TEST 5: Conversation analysis context output")
print("=" * 60)
ctx = ca.build_addressed_context(456, "Stijn", "op welke api zit je dan", "Danique")
print(ctx)
print()
print("=" * 60)
print("TEST 6: Technisch bericht zonder namen")
print("=" * 60)
ca2 = ConversationAnalyzer("/tmp/test_conv_b.db")
ca2.record_message(789, "Pieter", "ik heb die server geconfigureerd", "Danique")
ca2.record_message(789, "Stijn", "nice, push je het naar de repo?", "Danique")
ca2.record_message(789, "Pieter", "ja doe ik zo", "Danique")
r6 = ca2.get_likely_target(789, "Stijn", "heb je die endpoint al getest?", "Danique")
print(f"Target: {r6['target']}")
print(f"Is Danique: {r6['is_danique']}")
print(f"Confidence: {r6['confidence']:.0%}")
print(f"Signals: {r6['signals']}")
print(f"Scores: {r6['scores']}")
# Cleanup
import glob
for f in glob.glob("/tmp/test_conv_*.db"):
os.remove(f)