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 @@ -659,29 +659,31 @@ # regex morph arcs if "" in dNode: for sRegex in dNode[""]: if "¬" not in sRegex: # no anti-pattern - if any(re.search(sRegex, sMorph) for sMorph in _oSpellChecker.getMorph(dToken["sValue"])): + lMorph = dToken.get("lMorph", _oSpellChecker.getMorph(dToken["sValue"])) + if any(re.search(sRegex, sMorph) for sMorph in lMorph): if bDebug: print(" MATCH: @" + sRegex) yield dGraph[dNode[""][sRegex]] else: # there is an anti-pattern sPattern, sNegPattern = sRegex.split("¬", 1) if sNegPattern == "*": # all morphologies must match with if sPattern: - lMorph = _oSpellChecker.getMorph(dToken["sValue"]) + lMorph = dToken.get("lMorph", _oSpellChecker.getMorph(dToken["sValue"])) if lMorph and all(re.search(sPattern, sMorph) for sMorph in lMorph): if bDebug: print(" MATCH: @" + sRegex) yield dGraph[dNode[""][sRegex]] else: - if sNegPattern and any(re.search(sNegPattern, sMorph) for sMorph in _oSpellChecker.getMorph(dToken["sValue"])): + lMorph = dToken.get("lMorph", _oSpellChecker.getMorph(dToken["sValue"])) + if sNegPattern and any(re.search(sNegPattern, sMorph) for sMorph in lMorph): continue - if not sPattern or any(re.search(sPattern, sMorph) for sMorph in _oSpellChecker.getMorph(dToken["sValue"])): + if not sPattern or any(re.search(sPattern, sMorph) for sMorph in lMorph): if bDebug: print(" MATCH: @" + sRegex) yield dGraph[dNode[""][sRegex]] # token tags if "tags" in dToken and "" in dNode: @@ -1015,12 +1017,12 @@ lMorph = _oSpellChecker.getMorph(dToken["sValue"][slice(nLeft, nRight)]) if bMemorizeMorph: dToken["lMorph"] = lMorph else: lMorph = _oSpellChecker.getMorph(dToken["sValue"]) - if not lMorph: - return False + if not lMorph: + return False # check negative condition if sNegPattern: if sNegPattern == "*": # all morph must match sPattern if not lMorph: