21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
return "vous"
if s2 == "nous":
return "nous"
if s2 == "vous":
return "vous"
if s2 == "eux":
return "ils"
if s2 == "elle" or s2 == "elles":
if cr.mbNprMasNotFem(_oSpellChecker.getMorph(s1)):
return "ils"
# si épicène, indéterminable, mais OSEF, le féminin l’emporte
return "elles"
return s1 + " et " + s2
|
|
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
return "vous"
if s2 == "nous":
return "nous"
if s2 == "vous":
return "vous"
if s2 == "eux":
return "ils"
if s2 in ("elle", "elles"):
if cr.mbNprMasNotFem(_oSpellChecker.getMorph(s1)):
return "ils"
# si épicène, indéterminable, mais OSEF, le féminin l’emporte
return "elles"
return s1 + " et " + s2
|
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
|
if cr.mbVconj(lMorph) and not cr.mbMG(lMorph):
return True
return False
def isAmbiguousAndWrong (sWord1, sWord2, sReqMorphNA, sReqMorphConj):
"use it if <sWord1> won’t be a verb; <sWord2> is assumed to be True via isAmbiguousNAV"
a2 = _oSpellChecker.getMorph(sWord2)
if not a2:
return False
if cr.checkConjVerb(a2, sReqMorphConj):
# verb word2 is ok
return False
a1 = _oSpellChecker.getMorph(sWord1)
if not a1:
return False
if cr.checkAgreement(a1, a2) and (cr.mbAdj(a2) or cr.mbAdj(a1)):
return False
return True
def isVeryAmbiguousAndWrong (sWord1, sWord2, sReqMorphNA, sReqMorphConj, bLastHopeCond):
"use it if <sWord1> can be also a verb; <sWord2> is assumed to be True via isAmbiguousNAV"
a2 = _oSpellChecker.getMorph(sWord2)
if not a2:
return False
if cr.checkConjVerb(a2, sReqMorphConj):
# verb word2 is ok
return False
a1 = _oSpellChecker.getMorph(sWord1)
if not a1:
return False
if cr.checkAgreement(a1, a2) and (cr.mbAdj(a2) or cr.mbAdjNb(a1)):
return False
# now, we know there no agreement, and conjugation is also wrong
if cr.isNomAdj(a1):
return True
#if cr.isNomAdjVerb(a1): # considered True
if bLastHopeCond:
return True
return False
def checkAgreement (sWord1, sWord2):
"check agreement between <sWord1> and <sWord1>"
a2 = _oSpellChecker.getMorph(sWord2)
if not a2:
return True
a1 = _oSpellChecker.getMorph(sWord1)
if not a1:
return True
return cr.checkAgreement(a1, a2)
_zUnitSpecial = re.compile("[µ/⁰¹²³⁴⁵⁶⁷⁸⁹Ωℓ·]")
_zUnitNumbers = re.compile("[0-9]")
def mbUnit (s):
"returns True it can be a measurement unit"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
if cr.mbVconj(lMorph) and not cr.mbMG(lMorph):
return True
return False
def isAmbiguousAndWrong (sWord1, sWord2, sReqMorphNA, sReqMorphConj):
"use it if <sWord1> won’t be a verb; <sWord2> is assumed to be True via isAmbiguousNAV"
lMorph2 = _oSpellChecker.getMorph(sWord2)
if not lMorph2:
return False
if cr.checkConjVerb(lMorph2, sReqMorphConj):
# verb word2 is ok
return False
lMorph1 = _oSpellChecker.getMorph(sWord1)
if not lMorph1:
return False
if cr.checkAgreement(lMorph1, lMorph2) and (cr.mbAdj(lMorph2) or cr.mbAdj(lMorph1)):
return False
return True
def isVeryAmbiguousAndWrong (sWord1, sWord2, sReqMorphNA, sReqMorphConj, bLastHopeCond):
"use it if <sWord1> can be also a verb; <sWord2> is assumed to be True via isAmbiguousNAV"
lMorph2 = _oSpellChecker.getMorph(sWord2)
if not lMorph2:
return False
if cr.checkConjVerb(lMorph2, sReqMorphConj):
# verb word2 is ok
return False
lMorph1 = _oSpellChecker.getMorph(sWord1)
if not lMorph1:
return False
if cr.checkAgreement(lMorph1, lMorph2) and (cr.mbAdj(lMorph2) or cr.mbAdjNb(lMorph1)):
return False
# now, we know there no agreement, and conjugation is also wrong
if cr.isNomAdj(lMorph1):
return True
#if cr.isNomAdjVerb(lMorph1): # considered True
if bLastHopeCond:
return True
return False
def checkAgreement (sWord1, sWord2):
"check agreement between <sWord1> and <sWord1>"
lMorph2 = _oSpellChecker.getMorph(sWord2)
if not lMorph2:
return True
lMorph1 = _oSpellChecker.getMorph(sWord1)
if not lMorph1:
return True
return cr.checkAgreement(lMorph1, lMorph2)
_zUnitSpecial = re.compile("[µ/⁰¹²³⁴⁵⁶⁷⁸⁹Ωℓ·]")
_zUnitNumbers = re.compile("[0-9]")
def mbUnit (s):
"returns True it can be a measurement unit"
|