-
Notifications
You must be signed in to change notification settings - Fork 12
/
regression_tests.py
executable file
·38 lines (25 loc) · 1.41 KB
/
regression_tests.py
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
#!/usr/bin/env python3
import sys
from greek_inflexion import GreekInflexion
mi = GreekInflexion("stemming.yaml", "STEM_DATA/morphgnt_lexicon.yaml")
incorrect_count = 0
def test(ref, inflexion, lemma, key, expected):
global incorrect_count
result = set(inflexion.generate(lemma, key))
if result != expected:
print(f"failed {ref} {lemma} {key} {expected} (got {result}))")
incorrect_count += 1
test("#3", mi, "ἀνίστημι", "AMD.2S", {"ἀνάστησαι"})
test("#3", mi, "ἀνίστημι", "AMD.3S", {"ἀναστησάσθω"})
test("#3", mi, "ἀνίστημι", "AMD.2P", {"ἀναστήσασθε"})
test("#3", mi, "ἀνίστημι", "AMD.3P", {"ἀναστησάσθων"})
test("#29", mi, "δίδωμι", "PAP.DPF", {"διδούσαις"})
test("#30", mi, "τίθημι", "AAS.3P", {"θῶσι(ν)", "θήσωσι(ν)"})
test("#30", mi, "τίθημι", "AMP.APF", {"θεμένᾱς", "θησαμένᾱς"})
test("#30", mi, "τίθημι", "AMP.APM", {"θεμένους", "θησαμένους"})
test("#30", mi, "τίθημι", "AMP.APN", {"θέμενα", "θησάμενα"})
test("#30", mi, "τίθημι", "AMP.ASF", {"θεμένην", "θησαμένην"})
test("#30", mi, "τίθημι", "AMP.DPF", {"θεμέναις", "θησαμέναις"})
test("#30", mi, "τίθημι", "AMP.DPM", {"θεμένοις", "θησαμένοις"})
if incorrect_count > 0:
sys.exit(1)