pyeeg.features.SyntacticFeatureExtractor

class pyeeg.features.SyntacticFeatureExtractor(config: ParserConfig = None)

Extract syntactic features from text using constituency parsing.

Wraps an external constituency parser (Stanford Parser for English or Alpino for Dutch) and computes per-word syntactic features (depth, opening, closing, tree height) from the resulting parse trees. Feature values are returned in word order, so they can be aligned with neural signals via pyeeg.features.alignment.

Based on: process_txt/pyProcess/parseMetrics.py by Hugo Weissbart

Methods

SyntacticFeatureExtractor.closing_single_tree(tree)

Get closing values for each leaf.

SyntacticFeatureExtractor.depth_single_tree(tree)

Get depth of each leaf in the parse tree.

SyntacticFeatureExtractor.extract(text[, ...])

Extract syntactic features from text.

SyntacticFeatureExtractor.extract_from_tree(...)

Extract requested features from a single parse tree.

SyntacticFeatureExtractor.extract_to_array(text)

Extract features and return as arrays.

SyntacticFeatureExtractor.extract_to_dict(text)

Extract features and return as word position -> value dict.

SyntacticFeatureExtractor.get_alpinopy_tree(...)

Parse Dutch sentences using the Alpino parser.

SyntacticFeatureExtractor.get_stanford_tree(...)

Parse sentences using the Stanford Parser.

SyntacticFeatureExtractor.opening_single_tree(tree)

Get opening values for each leaf.

SyntacticFeatureExtractor.parse_text(text)

Parse text into constituency trees.