-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_data.py
More file actions
41 lines (32 loc) · 1.67 KB
/
Copy pathverify_data.py
File metadata and controls
41 lines (32 loc) · 1.67 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
import json
def verify():
with open("src/data/dictionaries/dictionary.json", "r", encoding="utf-8") as f:
data = json.load(f)
words = {w["dictionary_form"]["kana"]: w for w in data["words"]}
words_by_id = {w["id"]: w for w in data["words"]}
# Target words that are commonly conjugated incorrectly in automated scripts
test_cases = [
("いく", "godan", "いって", "いかない"), # Iku exception
("かえる", "godan", "かえって", "かえらない"), # Godan Ru-trap
("たべる", "ichidan", "たべて", "たべない"), # Standard Ichidan
("くる", "kuru", "きて", "こない"), # Irregular
("よい", "i-adj", "よくて", "よくない") # Adjective exception; polite stays いいです
]
print(f"{'Word':<10} | {'Group':<10} | {'Te-Form':<10} | {'Negative':<10} | {'Status'}")
print("-" * 65)
for kana, group, exp_te, exp_neg in test_cases:
w = words.get(kana)
if not w and kana == "よい":
w = words.get("いい") or words_by_id.get("ia_yoi")
if not w:
print(f"{kana:<10} | {'MISSING':<10}")
continue
te = w["conjugations"].get("te_form", "")
neg = w["conjugations"].get("negative_plain", "")
is_correct = (te == exp_te and neg == exp_neg and w["group"] == group)
status = "✅ PASS" if is_correct else "❌ FAIL"
print(f"{kana:<10} | {w['group']:<10} | {te:<10} | {neg:<10} | {status}")
if not is_correct:
print(f" Expected: {group:<10} | {exp_te:<10} | {exp_neg:<10}")
if __name__ == "__main__":
verify()