Index: darg.py ================================================================== --- darg.py +++ darg.py @@ -157,19 +157,24 @@ def getNodeAsDict (self): "returns the node as a dictionary structure" dNode = {} dRegex = {} dRules = {} - for arc, oNode in self.dArcs.items(): - if type(arc) == str and arc.startswith("~"): - dRegex[arc[1:]] = oNode.__hash__() - elif arc.startswith("##"): - dRules[arc[1:]] = oNode.__hash__() + dLemmas = {} + for sArc, oNode in self.dArcs.items(): + if sArc.startswith("~") and len(sArc) > 1: + dRegex[sArc[1:]] = oNode.__hash__() + elif sArc.startswith(">") and len(sArc) > 1: + dLemmas[sArc[1:]] = oNode.__hash__() + elif sArc.startswith("##"): + dRules[sArc[1:]] = oNode.__hash__() else: - dNode[arc] = oNode.__hash__() + dNode[sArc] = oNode.__hash__() if dRegex: dNode[""] = dRegex + if dLemmas: + dNode[""] = dLemmas if dRules: dNode[""] = dRules #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 @@ -607,22 +607,23 @@ def _getNextMatchingNodes (self, dToken, dNode): # token value if dToken["sValue"] in dNode: yield dGraph[dNode[dToken["sValue"]]] # token lemmas - for sLemma in _oSpellChecker.getLemma(dToken["sValue"]): - if sLemma in dNode: - yield dGraph[dNode[sLemma]] + if "" in dNode: + for sLemma in _oSpellChecker.getLemma(dToken["sValue"]): + if sLemma in dNode[""]: + yield dGraph[dNode[""][sLemma]] # universal arc if "*" in dNode: yield dGraph[dNode["*"]] # regex arcs - if "~" in dNode: + if "" in dNode: for sRegex in dNode["~"]: for sMorph in _oSpellChecker.getMorph(dToken["sValue"]): if re.search(sRegex, sMorph): - yield dGraph[dNode["~"][sRegex]] + yield dGraph[dNode["regex"][sRegex]] def _executeActions (self, dNode, nOffset): for sLineId, nextNodeKey in dNode.items(): for sArc in dGraph[nextNodeKey]: print(sArc)