348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
|
"pseudo", "pré", "re", "ré", "sans", "sous", "supra", "sur", "ultra"
])
aPfx2 = frozenset([
"belgo", "franco", "génito", "gynéco", "médico", "russo"
])
_zMotAvecPronom = re.compile("^(?i)(\\w+)(-(?:t-|)(?:ils?|elles?|on|je|tu|nous|vous|ce))$")
def cut (sWord):
"returns a tuple of strings (prefix, trimed_word, suffix)"
m = _zMotAvecPronom.search(sWord)
if m:
return ("", m.group(1), m.group(2))
return ("", sWord, "")
# Other functions
def filterSugg (aSugg):
"exclude suggestions"
return filter(lambda sSugg: not sSugg.endswith(("è", "È")), aSugg)
|
>
|
>
>
|
>
>
>
>
|
>
|
|
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
|
"pseudo", "pré", "re", "ré", "sans", "sous", "supra", "sur", "ultra"
])
aPfx2 = frozenset([
"belgo", "franco", "génito", "gynéco", "médico", "russo"
])
_zWordPrefixes = re.compile("(?i)^([ldmtsnjcç]|lorsqu|presqu|jusqu|puisqu|quoiqu|quelqu|qu)[’'‘`]([\\w-]+)")
_zWordSuffixes = re.compile("(?i)^(\\w+)(-(?:t-|)(?:ils?|elles?|on|je|tu|nous|vous|ce))$")
def cut (sWord):
"returns a tuple of strings (prefix, trimed_word, suffix)"
sPrefix = ""
sSuffix = ""
m = _zWordPrefixes.search(sWord)
if m:
sPrefix = m.group(1) + "’"
sWord = m.group(2)
m = _zWordSuffixes.search(sWord)
if m:
sWord = m.group(1)
sSuffix = m.group(2)
return (sPrefix, sWord, sSuffix)
# Other functions
def filterSugg (aSugg):
"exclude suggestions"
return filter(lambda sSugg: not sSugg.endswith(("è", "È")), aSugg)
|