Grammalecte  Diff

Differences From Artifact [7e9f6a7653]:

To Artifact [e83ec424d3]:


153
154
155
156
157
158
159
160


161
162
163


164
165


166
167
168
169
170
171
172
173




174
175
176
177
178
179
180
153
154
155
156
157
158
159

160
161
162
163
164
165
166


167
168
169
170
171
172
173
174


175
176
177
178
179
180
181
182
183
184
185







-
+
+



+
+
-
-
+
+






-
-
+
+
+
+







        # Used as a key in a python dictionary.
        # Nodes are equivalent if they have identical arcs, and each identical arc leads to identical states.
        return self.__str__() == other.__str__()        

    def getNodeAsDict (self):
        "returns the node as a dictionary structure"
        dNode = {}
        dRegex = {}
        dReValue = {}
        dReMorph = {}
        dRules = {}
        dLemmas = {}
        for sArc, oNode in self.dArcs.items():
            if sArc.startswith("~~") and len(sArc) > 2:
                dReMorph[sArc[1:]] = oNode.__hash__()
            if sArc.startswith("~") and len(sArc) > 1:
                dRegex[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__()
            elif sArc.startswith("##"):
                dRules[sArc[1:]] = oNode.__hash__()
            else:
                dNode[sArc] = oNode.__hash__()
        if dRegex:
            dNode["<regex>"] = dRegex
        if dReValue:
            dNode["<re_value>"] = dReValue
        il dReMorph:
            dNode["<re_morph>"] = dReMorph
        if dLemmas:
            dNode["<lemmas>"] = dLemmas
        if dRules:
            dNode["<rules>"] = dRules
        #if self.bFinal:
        #    dNode["<final>"] = 1
        return dNode