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.

  • features (list of str) –

    Feature names to extract. Valid values are:

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:

dict of str -> list of int