51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
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
87
88
89
90
91
92
|
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
|
self.assertTrue(self.oSpellChecker.isValid(sWord), sWord)
def test_isvalid_failed (self):
for sWord in ["BranchE", "BRanche", "BRAnCHE", "émilie", "éMILIE", "émiLie", "aujourd'hui", "Aujourd'hui", ]:
self.assertFalse(self.oSpellChecker.isValid(sWord), sWord)
def test_suggest (self):
for sWord in [
"déelirranttesss", "vallidasion", "Emilie", "exibission", "ditirembique", "jai", "email",
"fatiqué", "coeur", "trèèèèèèèèès", "vraaaaiiiimeeeeennnt", "apele", "Co2",
"emmppâiiiller", "testt", "apelaion", "exsepttion", "sintaxik", "ebriete", "ennormmement"
for sWrong, sSugg in [
("chassis", "châssis"),
("francais", "français"),
("déelirranttesss", "délirantes"),
("vallidasion", "validation"),
("Emilie", "Émilie"),
("exibission", "exhibition"),
("ditirembique", "dithyrambique"),
("jai", "j’ai"),
("email", "courriel"),
("fatiqué", "fatigué"),
("coeur", "cœur"),
("trèèèèèèèèès", "très"),
("vraaaaiiiimeeeeennnt", "vraiment"),
("apele", "appel"),
("Co2", "CO₂"),
("emmppâiiiller", "empailler"),
("testt", "test"),
("apelaion", "appellation"),
("exsepttion", "exception"),
("sintaxik", "syntaxique"),
("ebriete", "ébriété"),
("ennormmement", "énormément")
]:
#with timeblock(sWord):
for lSugg in self.oSpellChecker.suggest(sWord):
for lSugg in self.oSpellChecker.suggest(sWrong):
#print(sWord, "->", " ".join(lSugg))
self.assertTrue(len(lSugg) > 0)
self.assertIn(sSugg, lSugg)
def test_lemmas (self):
for sWord, sInfi in [
("suis", "suivre"),
("suis", "être"),
("a", "avoir"),
|