Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code error2 #5

Open
JinfenLi opened this issue Jun 5, 2020 · 1 comment
Open

code error2 #5

JinfenLi opened this issue Jun 5, 2020 · 1 comment

Comments

@JinfenLi
Copy link

JinfenLi commented Jun 5, 2020

the relation of the node may be wrong because when assigning a relation to a node, the relation of its left or right child may be changed already.

def back_prop(tree, doc):
""" Starting from leaf node, propagating node
information back to root node
:type tree: SpanNode instance
:param tree: an binary RST tree
"""
tree_nodes = RstTree.BFTbin(tree)
tree_nodes.reverse()
for node in tree_nodes:
if (node.lnode is not None) and (node.rnode is not None):
# Non-leaf node
node.edu_span = RstTree.__getspaninfo(node.lnode, node.rnode)
node.text = RstTree.__gettextinfo(doc.edu_dict, node.edu_span)
if node.relation is None:
# If it is a new node created by binarization
if node.prop == 'Root':
pass
else:
node.relation = RstTree.__getrelationinfo(node.lnode, node.rnode)

@grig-guz
Copy link

grig-guz commented Aug 9, 2020

This only happens for nodes created during binarization though - if left and right child are "real" nodes then their relations wouldn't have changed, and if left or right child are also created during binarization, then they should have received the correct relation from below since we are going bottom up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants