Index: compile_rules_graph.py ================================================================== --- compile_rules_graph.py +++ compile_rules_graph.py @@ -326,11 +326,11 @@ elif sFuncName.startswith("g_s_"): # suggestion sParams = "lToken" elif sFuncName.startswith("g_p_"): # preprocessor sParams = "lToken" elif sFuncName.startswith("g_d_"): # disambiguator - sParams = "lToken" + sParams = "lToken, nTokenOffset" else: print("# Unknown function type in [" + sFuncName + "]") continue sPyCallables += "def {} ({}):\n".format(sFuncName, sParams) sPyCallables += " return " + sReturn + "\n" Index: gc_core/py/lang_core/gc_engine.py ================================================================== --- gc_core/py/lang_core/gc_engine.py +++ gc_core/py/lang_core/gc_engine.py @@ -682,11 +682,11 @@ self._tagAndPrepareTokenForRewriting(sWhat, nTokenOffset + eAct[0], nTokenOffset + eAct[1]) bChange = True elif cActionType == "=": # disambiguation print("=") - globals()[sWhat](self.lToken) + globals()[sWhat](self.lToken, nTokenOffset) elif cActionType == ">": # we do nothing, this test is just a condition to apply all following actions print(">") pass else: @@ -880,40 +880,45 @@ "select morphologies for according to , always return True" lMorph = dToken["lMorph"] if "lMorph" in dToken else _oSpellChecker.getMorph(dToken["sValue"]) if not lMorph or len(lMorph) == 1: if lDefault: dToken["lMorph"] = lDefault + #print("DA:", dToken["sValue"], dToken["lMorph"]) return True lSelect = [ sMorph for sMorph in lMorph if re.search(sPattern, sMorph) ] if lSelect: if len(lSelect) != len(lMorph): dToken["lMorph"] = lSelect elif lDefault: dToken["lMorph"] = lDefault + #print("DA:", dToken["sValue"], dToken["lMorph"]) return True def g_exclude (dToken, sPattern, lDefault=None): "select morphologies for according to , always return True" lMorph = dToken["lMorph"] if "lMorph" in dToken else _oSpellChecker.getMorph(dToken["sValue"]) if not lMorph or len(lMorph) == 1: if lDefault: dToken["lMorph"] = lDefault + #print("DA:", dToken["sValue"], dToken["lMorph"]) return True lSelect = [ sMorph for sMorph in lMorph if not re.search(sPattern, sMorph) ] if lSelect: if len(lSelect) != len(lMorph): dToken["lMorph"] = lSelect elif lDefault: dToken["lMorph"] = lDefault + #print("DA:", dToken["sValue"], dToken["lMorph"]) return True def g_define (dToken, lMorph): "set morphologies of , always return True" dToken["lMorph"] = lMorph + #print("DA:", dToken["sValue"], lMorph) return True #### CALLABLES (generated code) ${graph_callables} Index: gc_lang/fr/rules_graph.grx ================================================================== --- gc_lang/fr/rules_graph.grx +++ gc_lang/fr/rules_graph.grx @@ -36,10 +36,31 @@ # Fin d’interprétation du fichier avec une ligne commençant par #END # ERREURS COURANTES # http://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Fautes_d%27orthographe/Courantes + +__da1__ + ne >donner + <<- =>> select(\2, ":V") + +TEST: je ne donne rien. + + +__da2__ + je >pousser + <<- =>> exclude(\2, ":N") + +TEST: je pousse + + +__da3__ + il >venir + <<- =>> define(\2, [":VVV"]) + +TEST: il vient + __pp__ >avoir marre [d’|des|du|de] <<- ~>> *