pyeeg.features.SyntacticFeatureExtractor.extract_from_tree
- SyntacticFeatureExtractor.extract_from_tree(tree: None, features: List[str]) Dict[str, List[int]]
Extract requested features from a single parse tree.
- Parameters:
tree (nltk.tree.Tree) – Constituency parse tree.
Feature names to extract. Valid values are:
"depth": depth of each leaf viadepth_single_tree()"opening": opening value of each leaf viaopening_single_tree()"closing": closing value of each leaf viaclosing_single_tree()"tree_height": height of the whole tree, repeated once per leaf"all": all of the above features
- Returns:
result – Mapping from feature name to the per-leaf values, in leaf (word) order. Each list has one entry per leaf of
tree. Unknown feature names are silently ignored.- Return type: