I m working with the Stanford Parser in ruby and want to search for all nodes of a tree with a particular label name. This is the recursive method i have coded so far
def searchTreeWithLabel(tree,lablename,listOfNodes)
if tree.instance_of?(StanfordParser::Tree)
if tree.lable.toString == lablename then
listOfNodes << tree
else
tree.children.each { |c| searchTreeWithLabel(c, lablename, listOfNodes)}
end
end
listOfNodes
end
i 想要归还一个标明为标签的树苗清单的方法