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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
def getVtyp (sVerb):
"returns raw informations about sVerb"
if sVerb not in _dVerb:
return None
return _lVtyp[_dVerb[sVerb][0]]
def getSimil (sWord, sMorph, bSubst=False):
"returns a list of verbal forms similar to <sWord>, according to <sMorph>"
if ":V" not in sMorph:
return []
sInfi = sMorph[1:sMorph.find("/")]
aSugg = []
tTags = _getTags(sInfi)
if tTags:
if not bSubst:
# we suggest conjugated forms
if ":V1" in sMorph:
aSugg.append(sInfi)
if _hasConjWithTags(tTags, ":Ip", ":3s"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Ip", ":3s"))
if _hasConjWithTags(tTags, ":Ip", ":2p"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Ip", ":2p"))
if _hasConjWithTags(tTags, ":Iq", ":1s"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Iq", ":1s"))
if _hasConjWithTags(tTags, ":Iq", ":3s"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Iq", ":3s"))
if _hasConjWithTags(tTags, ":Iq", ":3p"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Iq", ":3p"))
elif ":V2" in sMorph:
if _hasConjWithTags(tTags, ":Ip", ":1s"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Ip", ":1s"))
if _hasConjWithTags(tTags, ":Ip", ":3s"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Ip", ":3s"))
elif ":V3" in sMorph:
if _hasConjWithTags(tTags, ":Ip", ":1s"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Ip", ":1s"))
if _hasConjWithTags(tTags, ":Ip", ":3s"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Ip", ":3s"))
if _hasConjWithTags(tTags, ":Is", ":1s"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Is", ":1s"))
if _hasConjWithTags(tTags, ":Is", ":3s"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Is", ":3s"))
elif ":V0a" in sMorph:
aSugg.append("eus")
aSugg.append("eut")
else:
aSugg.append("étais")
aSugg.append("était")
else:
if sInfi in _dVerbNames:
# there are names derivated from the verb
aSugg.extend(_dVerbNames[sInfi])
else:
# we suggest past participles
aSugg.append(_getConjWithTags(sInfi, tTags, ":PQ", ":Q1"))
if _hasConjWithTags(tTags, ":PQ", ":Q2"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":PQ", ":Q2"))
if _hasConjWithTags(tTags, ":PQ", ":Q3"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":PQ", ":Q3"))
if _hasConjWithTags(tTags, ":PQ", ":Q4"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":PQ", ":Q4"))
# if there is only one past participle (epi inv), unreliable.
if len(aSugg) == 1:
return []
return aSugg
def getConjSimilInfiV1 (sInfi):
"returns verbal forms phonetically similar to infinitive form (for verb in group 1)"
if sInfi not in _dVerb:
return []
aSugg = []
tTags = _getTags(sInfi)
if tTags:
if _hasConjWithTags(tTags, ":Iq", ":2s"):
aSugg.add(_getConjWithTags(sInfi, tTags, ":Iq", ":2s"))
if _hasConjWithTags(tTags, ":Iq", ":3s"):
aSugg.add(_getConjWithTags(sInfi, tTags, ":Iq", ":3s"))
if _hasConjWithTags(tTags, ":Iq", ":3p"):
aSugg.add(_getConjWithTags(sInfi, tTags, ":Iq", ":3p"))
if _hasConjWithTags(tTags, ":Is", ":1s"):
aSugg.add(_getConjWithTags(sInfi, tTags, ":Is", ":1s"))
if _hasConjWithTags(tTags, ":Ip", ":2p"):
aSugg.add(_getConjWithTags(sInfi, tTags, ":Ip", ":2p"))
if _hasConjWithTags(tTags, ":Iq", ":2p"):
aSugg.add(_getConjWithTags(sInfi, tTags, ":Iq", ":2p"))
return aSugg
def _getTags (sVerb):
"returns tuple of tags (usable with functions _getConjWithTags and _hasConjWithTags)"
if sVerb not in _dVerb:
return None
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|
|
|
>
>
|
|
|
|
|
|
|
|
|
|
<
>
|
|
|
|
|
|
|
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
|
def getVtyp (sVerb):
"returns raw informations about sVerb"
if sVerb not in _dVerb:
return None
return _lVtyp[_dVerb[sVerb][0]]
def getNamesFrom (sVerb):
"returns a list of names derivating from <sVerb>"
if sVerb in _dVerbNames:
# there are names derivated from the verb
return list(_dVerbNames[sVerb])
else:
# we suggest past participles
tTags = _getTags(sVerb)
if tTags:
aSugg = [ _getConjWithTags(sVerb, tTags, ":PQ", ":Q1") ]
if _hasConjWithTags(tTags, ":PQ", ":Q2"):
aSugg.append(_getConjWithTags(sVerb, tTags, ":PQ", ":Q2"))
if _hasConjWithTags(tTags, ":PQ", ":Q3"):
aSugg.append(_getConjWithTags(sVerb, tTags, ":PQ", ":Q3"))
if _hasConjWithTags(tTags, ":PQ", ":Q4"):
aSugg.append(_getConjWithTags(sVerb, tTags, ":PQ", ":Q4"))
# if there is only one past participle (epi inv), unreliable.
return aSugg if len(aSugg) > 1 else []
return []
def getConjSimilInfiV1 (sInfi):
"returns verbal forms phonetically similar to infinitive form (for verb in group 1)"
if sInfi not in _dVerb:
return []
aSugg = []
tTags = _getTags(sInfi)
if tTags:
# example: arriver, arrivais, arrivait, arrivai, arrivez, arriviez
if _hasConjWithTags(tTags, ":Iq", ":2s"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Iq", ":2s"))
if _hasConjWithTags(tTags, ":Iq", ":3s"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Iq", ":3s"))
if _hasConjWithTags(tTags, ":Iq", ":3p"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Iq", ":3p"))
if _hasConjWithTags(tTags, ":Is", ":1s"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Is", ":1s"))
if _hasConjWithTags(tTags, ":Ip", ":2p"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Ip", ":2p"))
if _hasConjWithTags(tTags, ":Iq", ":2p"):
aSugg.append(_getConjWithTags(sInfi, tTags, ":Iq", ":2p"))
return aSugg
def _getTags (sVerb):
"returns tuple of tags (usable with functions _getConjWithTags and _hasConjWithTags)"
if sVerb not in _dVerb:
return None
|