pyeeg.features.SyntacticFeatureExtractor.extract

SyntacticFeatureExtractor.extract(text: str, features: List[str] = None) Dict[str, List[int]]

Extract syntactic features from text.

Parses the text (see parse_text()) and concatenates the per-tree features across all parse trees, so the returned lists contain one entry per word of the input text, in reading order.

Parameters:
  • text (str) – Input text to process.

  • features (list of str, optional) –

    Feature names to extract. Valid values are:

    • "depth"

    • "opening"

    • "closing"

    • "tree_height"

    • "all" (extract all four features)

    If None, defaults to ["all"].

Returns:

all_features – Mapping from feature name to the per-word values, concatenated across all sentences in reading order. Empty dict if parsing produced no trees.

Return type:

dict of str -> list of int