-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_quiz.py
More file actions
32 lines (26 loc) · 1.21 KB
/
debug_quiz.py
File metadata and controls
32 lines (26 loc) · 1.21 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
from src.preprocessor import Preprocessor
from src.extractor import ConceptExtractor
from src.hierarchy import HierarchyBuilder
from src.quiz import QuizGenerator
from src.utils import HeuristicNLP
with open("notes.txt", "r", encoding="utf-8") as f:
text = f.read()
doc = Preprocessor().process(text)
concepts = ConceptExtractor().extract(doc)
graph = HierarchyBuilder().build(doc, concepts)
generator = QuizGenerator(graph)
print(f"Total nodes: {len(graph.nodes)}")
print(f"\nChecking high-quality concepts:")
for node in list(graph.nodes.values())[:15]:
print(f"\n'{node.term}':")
print(f" Has def: {node.definition_sentence is not None}")
if node.definition_sentence:
print(f" Def: {node.definition_sentence[:80]}...")
print(f" Is def sentence: {HeuristicNLP.is_definition_sentence(node.definition_sentence)}")
s_lower = node.definition_sentence.lower()
t_lower = node.term.lower()
prefixes = [t_lower, f"a {t_lower}", f"an {t_lower}", f"the {t_lower}"]
starts_ok = any(s_lower.startswith(p) for p in prefixes)
print(f" Starts with term: {starts_ok}")
is_hq = generator._is_high_quality_concept(node)
print(f" ✓ HIGH QUALITY: {is_hq}")