This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#balanced tree construction | |
def build_tree(depth, sen): | |
assert len(depth) == len(sen) | |
assert len(depth) >= 0 | |
if len(depth) == 1: | |
parse_tree = sen[0] | |
else: | |
idx_max = numpy.argmax(depth[1:]) + 1 | |
parse_tree = [] |