153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
"t'en": " (te) pronom personnel objet + (en) pronom adverbial",
"s'en": " (se) pronom personnel objet + (en) pronom adverbial",
}
class Lexicographe:
def __init__ (self, oDict):
self.oDict = oDict
self._zElidedPrefix = re.compile("(?i)^([dljmtsncç]|quoiqu|lorsqu|jusqu|puisqu|qu)['’](.+)")
self._zCompoundWord = re.compile("(?i)(\\w+)-((?:les?|la)-(?:moi|toi|lui|[nv]ous|leur)|t-(?:il|elle|on)|y|en|[mts][’'](?:y|en)|les?|l[aà]|[mt]oi|leur|lui|je|tu|ils?|elles?|on|[nv]ous)$")
self._zTag = re.compile("[:;/][\\w*][^:;/]*")
def analyzeWord (self, sWord):
try:
if not sWord:
|
|
|
|
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
"t'en": " (te) pronom personnel objet + (en) pronom adverbial",
"s'en": " (se) pronom personnel objet + (en) pronom adverbial",
}
class Lexicographe:
def __init__ (self, oSpellChecker):
self.oSpellChecker = oSpellChecker
self._zElidedPrefix = re.compile("(?i)^([dljmtsncç]|quoiqu|lorsqu|jusqu|puisqu|qu)['’](.+)")
self._zCompoundWord = re.compile("(?i)(\\w+)-((?:les?|la)-(?:moi|toi|lui|[nv]ous|leur)|t-(?:il|elle|on)|y|en|[mts][’'](?:y|en)|les?|l[aà]|[mt]oi|leur|lui|je|tu|ils?|elles?|on|[nv]ous)$")
self._zTag = re.compile("[:;/][\\w*][^:;/]*")
def analyzeWord (self, sWord):
try:
if not sWord:
|
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
sWord = m.group(2)
aMorph.append( "{}’ : {}".format(m.group(1), _dPFX.get(m.group(1).lower(), "[?]")) )
# mots composés
m2 = self._zCompoundWord.match(sWord)
if m2:
sWord = m2.group(1)
# Morphologies
lMorph = self.oDict.getMorph(sWord)
if len(lMorph) > 1:
# sublist
aMorph.append( (sWord, [ self.formatTags(s) for s in lMorph if ":" in s ]) )
elif len(lMorph) == 1:
aMorph.append( "{} : {}".format(sWord, self.formatTags(lMorph[0])) )
else:
aMorph.append( "{} : inconnu du dictionnaire".format(sWord) )
|
|
|
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
sWord = m.group(2)
aMorph.append( "{}’ : {}".format(m.group(1), _dPFX.get(m.group(1).lower(), "[?]")) )
# mots composés
m2 = self._zCompoundWord.match(sWord)
if m2:
sWord = m2.group(1)
# Morphologies
lMorph = self.oSpellChecker.getMorph(sWord)
if len(lMorph) > 1:
# sublist
aMorph.append( (sWord, [ self.formatTags(s) for s in lMorph if ":" in s ]) )
elif len(lMorph) == 1:
aMorph.append( "{} : {}".format(sWord, self.formatTags(lMorph[0])) )
else:
aMorph.append( "{} : inconnu du dictionnaire".format(sWord) )
|