I am using malt parser with python nltk. I have successfully downloaded the training data and updated the latest nltk. When I call the malt parser it gives me an asertion error. Below is the code from python which includes the traceback as well.
mp = MaltParser("C:/Users/mustufain/Desktop/Python Files/maltparser-1.8.1","C:/Users/mustufain/Desktop/Python Files/maltparser-1.7.2",additional_java_args=['-Xmx512m'])
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
mp = MaltParser("C:/Users/mustufain/Desktop/Python Files/maltparser-1.8.1","C:/Users/mustufain/Desktop/Python Files/maltparser-1.7.2",additional_java_args=['-Xmx512m'])
File "C:\Python34\lib\site-packages\nltk\parse\malt.py", line 131, in __init__
self.malt_jars = find_maltparser(parser_dirname)
File "C:\Python34\lib\site-packages\nltk\parse\malt.py", line 72, in find_maltparser
assert malt_dependencies.issubset(_jars)
AssertionError
>>>
TL;DR
(In PYTHON3!!):Then:
If all the download and environmental variable setup is done correctly, most probably it's how file/dir path are splitted in the
nltk.parse.malt.py
, at https://github.com/nltk/nltk/blob/develop/nltk/parse/malt.py#L69 that splits the directory and filename specifically for linux:The bug has been fixed and in the process of merging at https://github.com/nltk/nltk/pull/1292
Changing this line:
to this should solve your problem =)
For the answer not related to the code itself but how you have setup the environment variables or downloaded and saved the malt parser directories or files, see https://github.com/nltk/nltk/issues/1294