pyeeg.features.SyntacticFeatureExtractor.opening_single_tree

SyntacticFeatureExtractor.opening_single_tree(tree: None) List[int]

Get opening values for each leaf.

For each leaf, counts how many branches open (i.e. how many sibling branches with index 0 precede it along its path from the root) after collapsing unary productions. Words earlier in the sentence tend to have higher opening values. The result is reversed for closing_single_tree().

Based on parseMetrics.py.

Parameters:

tree (nltk.tree.Tree) – Constituency parse tree.

Returns:

opening – Opening value of each leaf, in leaf (word) order. Length equals the number of leaves in tree.

Return type:

list of int