134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
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:
return ""
sWho = _dQuiEst.get(sSuj.lower(), None)
if not sWho:
if sSuj[0:1].islower(): # pas un pronom, ni un nom propre
return ""
sWho = ":3s"
aSugg = set()
for sStem in _oSpellChecker.getLemma(sFlex):
tTags = conj._getTags(sStem)
if tTags:
for sTense in lMode:
if conj._hasConjWithTags(tTags, sTense, sWho):
aSugg.add(conj._getConjWithTags(sStem, tTags, sTense, sWho))
|
|
|
|
<
<
<
<
|
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
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", "tu": ":2s", "il": ":3s", "on": ":3s", "elle": ":3s", "iel": ":3s", \
"nous": ":1p", "vous": ":2p", "ils": ":3p", "elles": ":3p", "iels": ":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:
return ""
sWho = _dQuiEst.get(sSuj.lower(), ":3s")
aSugg = set()
for sStem in _oSpellChecker.getLemma(sFlex):
tTags = conj._getTags(sStem)
if tTags:
for sTense in lMode:
if conj._hasConjWithTags(tTags, sTense, sWho):
aSugg.add(conj._getConjWithTags(sStem, tTags, sTense, sWho))
|