pyeeg.features.SyntacticFeatureExtractor.get_stanford_tree
- SyntacticFeatureExtractor.get_stanford_tree(sentences: List[str], path_to_jar: str | None = None) List[None]
Parse sentences using the Stanford Parser.
Loads the Stanford Parser via NLTK and parses each sentence, returning one parse tree per sentence. The parser classpath is derived from
path_to_jar(orconfig.parser_path); if the path does not exist, an attempt is made to locatestanford-parser.jarwith thelocatecommand. TheSTANDFORD_MODELSenvironment variable must be set, pointing to the Stanford models directory.Based on parseMetrics.py.
- Parameters:
- Returns:
trees – One parse tree per sentence, in input order.
- Return type:
list of nltk.tree.Tree
- Raises:
ImportError – If NLTK is not available.
IOError – If
stanford-parser.jarcannot be found or theSTANFORD_MODELSenvironment variable is not set.