155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
return self.__str__() == other.__str__()
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__()
else:
dNode[arc] = oNode.__hash__()
if dRegex:
dNode["<regex>"] = dRegex
if dRules:
dNode["<rules>"] = dRules
#if self.bFinal:
# dNode["<final>"] = 1
return dNode
|
>
|
|
|
>
>
|
|
|
>
>
|
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
|
return self.__str__() == other.__str__()
def getNodeAsDict (self):
"returns the node as a dictionary structure"
dNode = {}
dRegex = {}
dRules = {}
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[sArc] = oNode.__hash__()
if dRegex:
dNode["<regex>"] = dRegex
if dLemmas:
dNode["<lemmas>"] = dLemmas
if dRules:
dNode["<rules>"] = dRules
#if self.bFinal:
# dNode["<final>"] = 1
return dNode
|