pyeeg.features.SyntacticFeatureExtractor.get_alpinopy_tree
- SyntacticFeatureExtractor.get_alpinopy_tree(sentences: List[str]) List[None]
Parse Dutch sentences using the Alpino parser.
Uses the
alpinonafwrapper to parse each sentence. Based on parseMetrics.py.Notes
This method has filesystem side effects: it sets
tempfile.tempdirto/tmp/alpino(creating that directory if missing), writes each sentence to a temporary file with aalpino-prefix, and relies on the parser writing its output to a file namedpenn_output.txtin the current working directory, which is read back afterwards. The/tmp/alpinodirectory is removed withshutil.rmtree()before returning, andtempfile.tempdiris reset toNone. Callers should be aware thatpenn_output.txtis created in the working directory as a side effect, and that globaltempfilestate is temporarily modified.- Parameters:
sentences (list of str) – Dutch sentences to parse. Each element is parsed independently.
- Returns:
trees – One parse tree per sentence, in input order.
- Return type:
list of nltk.tree.Tree
- Raises:
ImportError – If
alpinonafis not available.