@@ -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