pyeeg.features.SyntacticFeatureExtractor.get_alpinopy_tree

SyntacticFeatureExtractor.get_alpinopy_tree(sentences: List[str]) List[None]

Parse Dutch sentences using the Alpino parser.

Uses the alpinonaf wrapper to parse each sentence. Based on parseMetrics.py.

Notes

This method has filesystem side effects: it sets tempfile.tempdir to /tmp/alpino (creating that directory if missing), writes each sentence to a temporary file with a alpino- prefix, and relies on the parser writing its output to a file named penn_output.txt in the current working directory, which is read back afterwards. The /tmp/alpino directory is removed with shutil.rmtree() before returning, and tempfile.tempdir is reset to None. Callers should be aware that penn_output.txt is created in the working directory as a side effect, and that global tempfile state 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 alpinonaf is not available.