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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
if aSugg2:
aSugg.add(aSugg2)
if aSugg:
return "|".join(aSugg)
return ""
def suggVerbPpas (sFlex, sWhat=None):
aSugg = set()
for sStem in _oSpellChecker.getLemma(sFlex):
tTags = conj._getTags(sStem)
if tTags:
if not sWhat:
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q2"))
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q3"))
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q4"))
aSugg.discard("")
elif sWhat == ":m:s":
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
elif sWhat == ":m:p":
if conj._hasConjWithTags(tTags, ":PQ", ":Q2"):
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q2"))
else:
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
elif sWhat == ":f:s":
if conj._hasConjWithTags(tTags, ":PQ", ":Q3"):
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q3"))
else:
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
elif sWhat == ":f:p":
if conj._hasConjWithTags(tTags, ":PQ", ":Q4"):
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q4"))
else:
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
elif sWhat == ":s":
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q3"))
aSugg.discard("")
elif sWhat == ":p":
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q2"))
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q4"))
aSugg.discard("")
else:
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
if aSugg:
return "|".join(aSugg)
return ""
def suggVerbTense (sFlex, sTense, sWho):
aSugg = set()
for sStem in _oSpellChecker.getLemma(sFlex):
if conj.hasConj(sStem, sTense, sWho):
aSugg.add(conj.getConj(sStem, sTense, sWho))
if aSugg:
return "|".join(aSugg)
return ""
def suggVerbImpe (sFlex):
aSugg = set()
for sStem in _oSpellChecker.getLemma(sFlex):
tTags = conj._getTags(sStem)
if tTags:
if conj._hasConjWithTags(tTags, ":E", ":2s"):
aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":2s"))
if conj._hasConjWithTags(tTags, ":E", ":1p"):
aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":1p"))
if conj._hasConjWithTags(tTags, ":E", ":2p"):
aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":2p"))
if aSugg:
return "|".join(aSugg)
return ""
def suggVerbInfi (sFlex):
return "|".join([ sStem for sStem in _oSpellChecker.getLemma(sFlex) if conj.isVerb(sStem) ])
_dQuiEst = { "je": ":1s", "j’": ":1s", "j’en": ":1s", "j’y": ":1s", \
"tu": ":2s", "il": ":3s", "on": ":3s", "elle": ":3s", "nous": ":1p", "vous": ":2p", "ils": ":3p", "elles": ":3p" }
_lIndicatif = [":Ip", ":Iq", ":Is", ":If"]
_lSubjonctif = [":Sp", ":Sq"]
def suggVerbMode (sFlex, cMode, sSuj):
if cMode == ":I":
lMode = _lIndicatif
elif cMode == ":S":
lMode = _lSubjonctif
elif cMode.startswith((":I", ":S")):
lMode = [cMode]
else:
|
|
>
|
|
|
|
|
|
|
>
>
>
>
|
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
if aSugg2:
aSugg.add(aSugg2)
if aSugg:
return "|".join(aSugg)
return ""
def suggVerbPpas (sFlex, sPattern=None):
"suggest past participles for <sFlex>"
aSugg = set()
for sStem in _oSpellChecker.getLemma(sFlex):
tTags = conj._getTags(sStem)
if tTags:
if not sPattern:
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q2"))
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q3"))
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q4"))
aSugg.discard("")
elif sPattern == ":m:s":
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
elif sPattern == ":m:p":
if conj._hasConjWithTags(tTags, ":PQ", ":Q2"):
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q2"))
else:
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
elif sPattern == ":f:s":
if conj._hasConjWithTags(tTags, ":PQ", ":Q3"):
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q3"))
else:
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
elif sPattern == ":f:p":
if conj._hasConjWithTags(tTags, ":PQ", ":Q4"):
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q4"))
else:
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
elif sPattern == ":s":
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q3"))
aSugg.discard("")
elif sPattern == ":p":
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q2"))
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q4"))
aSugg.discard("")
else:
aSugg.add(conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1"))
if aSugg:
return "|".join(aSugg)
return ""
def suggVerbTense (sFlex, sTense, sWho):
"change <sFlex> to a verb according to <sTense> and <sWho>"
aSugg = set()
for sStem in _oSpellChecker.getLemma(sFlex):
if conj.hasConj(sStem, sTense, sWho):
aSugg.add(conj.getConj(sStem, sTense, sWho))
if aSugg:
return "|".join(aSugg)
return ""
def suggVerbImpe (sFlex):
"change <sFlex> to a verb at imperative form"
aSugg = set()
for sStem in _oSpellChecker.getLemma(sFlex):
tTags = conj._getTags(sStem)
if tTags:
if conj._hasConjWithTags(tTags, ":E", ":2s"):
aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":2s"))
if conj._hasConjWithTags(tTags, ":E", ":1p"):
aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":1p"))
if conj._hasConjWithTags(tTags, ":E", ":2p"):
aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":2p"))
if aSugg:
return "|".join(aSugg)
return ""
def suggVerbInfi (sFlex):
"returns infinitive forms of <sFlex>"
return "|".join([ sStem for sStem in _oSpellChecker.getLemma(sFlex) if conj.isVerb(sStem) ])
_dQuiEst = { "je": ":1s", "j’": ":1s", "j’en": ":1s", "j’y": ":1s", \
"tu": ":2s", "il": ":3s", "on": ":3s", "elle": ":3s", "nous": ":1p", "vous": ":2p", "ils": ":3p", "elles": ":3p" }
_lIndicatif = [":Ip", ":Iq", ":Is", ":If"]
_lSubjonctif = [":Sp", ":Sq"]
def suggVerbMode (sFlex, cMode, sSuj):
"returns other conjugations of <sFlex> acconding to <cMode> and <sSuj>"
if cMode == ":I":
lMode = _lIndicatif
elif cMode == ":S":
lMode = _lSubjonctif
elif cMode.startswith((":I", ":S")):
lMode = [cMode]
else:
|