我基本上从事解析的树,并试图注释主导空类别(空节点注解)树节点。AttributeError的:“ParentedTree”对象有没有属性“标签”
我已经定义为低于recurvsive功能,但我得到的错误是“AttributeError的:‘ParentedTree’对象有没有属性‘标签’。”
def annotateTraceNodes(node):
numChildren = len(node);
numNone=0;
for child in node:
if isinstance(child,Tree):
annotateTraceNodes(child);
if(numChildren==0 or child.label().endswith("-NONE-")):
numNone+=1;
if(numChildren==numNone):
print "setting the label";
node.set_label(node.label()+"-NONE-");
有在此代码称为'ParentedTree' – 2014-10-29 04:12:34
很抱歉的混乱&错字错误没有对象。我纠正了错字。我如何使事情发挥作用? – Linguist 2014-10-29 04:18:33
行末不需要分号。这不是C/C++。 – IanAuld 2014-10-29 04:26:44