Index: gc_lang/fr/build_data.py ================================================================== --- gc_lang/fr/build_data.py +++ gc_lang/fr/build_data.py @@ -9,10 +9,11 @@ import os import grammalecte.ibdawg as ibdawg from grammalecte.echo import echo from grammalecte.str_transform import defineSuffixCode +import grammalecte.fr.conj as conj class cd: """Context manager for changing the current working directory""" def __init__ (self, newPath): @@ -267,11 +268,17 @@ with open(sp+"/data/phonet_simil.txt", 'r', encoding='utf-8') as hSrc: # set of homophonic words lSet = [] for sLine in hSrc.readlines(): if not sLine.startswith("#") and sLine.strip(): - lSet.append(sorted(sLine.strip().split())) + aWord = set(sLine.strip().split()) + aMore = set() + for sWord in aWord: + if sWord.endswith("er") and conj.isVerb(sWord): + aMore = aMore.union(conj.getConjSimilInfiV1(sWord)) + aWord = aWord.union(aMore) + lSet.append(aWord) # dictionary of words dWord = {} for i, aSet in enumerate(lSet): for sWord in aSet: if oDict.lookup(sWord): Index: gc_lang/fr/modules/conj.py ================================================================== --- gc_lang/fr/modules/conj.py +++ gc_lang/fr/modules/conj.py @@ -95,10 +95,25 @@ # if there is only one past participle (epi inv), unreliable. if len(aSugg) == 1: aSugg.clear() return aSugg + +def getConjSimilInfiV1 (sInfi): + if sInfi not in _dVerb: + return set() + tTags = _getTags(sInfi) + aSugg = set() + aSugg.add(_getConjWithTags(sInfi, tTags, ":Iq", ":2s")) + aSugg.add(_getConjWithTags(sInfi, tTags, ":Iq", ":3s")) + aSugg.add(_getConjWithTags(sInfi, tTags, ":Iq", ":3p")) + aSugg.add(_getConjWithTags(sInfi, tTags, ":Is", ":1s")) + aSugg.add(_getConjWithTags(sInfi, tTags, ":Ip", ":2p")) + aSugg.add(_getConjWithTags(sInfi, tTags, ":Iq", ":2p")) + aSugg.discard("") + return aSugg + def _getTags (sVerb): "returns tuple of tags (usable with functions _getConjWithTags and _hasConjWithTags)" if sVerb not in _dVerb: return None