Index: darg.py ================================================================== --- darg.py +++ darg.py @@ -155,29 +155,34 @@ def getNodeAsDict (self): "returns the node as a dictionary structure" dNode = {} dReValue = {} dReMorph = {} - dRules = {} - dLemmas = {} + dRule = {} + dLemma = {} + dMeta = {} for sArc, oNode in self.dArcs.items(): if sArc.startswith("@") and len(sArc) > 1: dReMorph[sArc[1:]] = oNode.__hash__() elif sArc.startswith("~") and len(sArc) > 1: dReValue[sArc[1:]] = oNode.__hash__() elif sArc.startswith(">") and len(sArc) > 1: - dLemmas[sArc[1:]] = oNode.__hash__() + dLemma[sArc[1:]] = oNode.__hash__() + elif sArc.startswith("*") and len(sArc) > 1: + dMeta[sArc[1:]] = oNode.__hash__() elif sArc.startswith("##"): - dRules[sArc[1:]] = oNode.__hash__() + dRule[sArc[1:]] = oNode.__hash__() else: dNode[sArc] = oNode.__hash__() if dReValue: dNode[""] = dReValue if dReMorph: dNode[""] = dReMorph - if dLemmas: - dNode[""] = dLemmas - if dRules: - dNode[""] = dRules + if dLemma: + dNode[""] = dLemma + if dMeta: + dNode[""] = dMeta + if dRule: + dNode[""] = dRule #if self.bFinal: # dNode[""] = 1 return dNode 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 @@ -627,16 +627,10 @@ for sLemma in _oSpellChecker.getLemma(dToken["sValue"]): if sLemma in dNode[""]: if bDebug: print(" MATCH: >" + sLemma) yield dGraph[dNode[""][sLemma]] - # universal arc - if "*" in dNode: - if dToken["sType"] != "PUNC": - if bDebug: - print(" MATCH: *") - yield dGraph[dNode["*"]] # regex value arcs if "" in dNode: for sRegex in dNode[""]: if "¬" not in sRegex: # no anti-pattern @@ -676,10 +670,27 @@ continue if not sPattern or any(re.search(sPattern, sMorph) for sMorph in _oSpellChecker.getMorph(dToken["sValue"])): if bDebug: print(" MATCH: @" + sRegex) yield dGraph[dNode[""][sRegex]] + # meta arc (for token type) + if "" in dNode: + for sMeta in dNode[""]: + if sMeta == "*": + if bDebug: + print(" MATCH: *" + sMeta) + yield dGraph[dNode[""]["*"]] + elif "¬" in sMeta: + if dNode["sType"] not in sMeta: + if bDebug: + print(" MATCH: *" + sMeta) + yield dGraph[dNode[""][sMeta]] + elif dNode["sType"] in sMeta: + if bDebug: + print(" MATCH: *" + sMeta) + yield dGraph[dNode[""][sMeta]] + def parse (self, dGraph, dPriority, sCountry="${country_default}", dOptions=None, bShowRuleId=False, bDebug=False, bContext=False): dErr = {} dPriority = {} # Key = position; value = priority dOpt = _dOptions if not dOptions else dOptions Index: gc_lang/fr/rules.grx ================================================================== --- gc_lang/fr/rules.grx +++ gc_lang/fr/rules.grx @@ -4742,14 +4742,14 @@ __locutions_invariables__ [plus|moins|autant] que [prévue|prévus|prévues] <<- -3>> prévu # Invariable. Implicitement, \1 que ce qui était prévu. - [plus|moins|aussi] * que [prévue|prévus|prévues] + [plus|moins|aussi] ** que [prévue|prévus|prévues] <<- -4>> prévu # Invariable. Implicitement, \1 \2 que ce qui était prévu. - [plus|moins|autant] [de|d’] * que [prévue|prévus|prévues] + [plus|moins|autant] [de|d’] ** que [prévue|prévus|prévues] <<- -5>> prévu # Invariable. Implicitement, \1 \2 \3 que ce qui était prévu. comme [annoncés|annoncée|annoncées] <<- -2>> annoncé # Invariable. Implicitement, comme ce qui était annoncé. @@ -5937,11 +5937,11 @@ maintes fois malgré [ça|cela|ceci|tout] manu militari mieux [vaut|valait] tard que jamais moins que [nécessaire|prévu] - moitié * ?,¿ moitié * + moitié ** ?,¿ moitié ** mot pour mot ne [lui|leur|m’|t’|nous|vous] en déplaise nez à nez non loin [de|d’] [ici|là] nulle part