pyeeg.features.SyntacticFeatureExtractor.closing_single_tree

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

Get closing values for each leaf.

For each leaf, counts how many branches close at that leaf. Computed by reversing every subtree of the (unary-collapsed) tree and taking the reversed opening values, so words later in the sentence tend to have higher closing values.

Based on parseMetrics.py.

Parameters:

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

Returns:

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

Return type:

list of int