如何在Windows上使用python使用MaltParser

时间:2014-12-05 15:50:18

标签: parsing python-2.7 nltk

我正在尝试在我的Windows机器上使用MaltParser的python nltk包装器进行依赖解析。我在这里找了几个帮助和帖子,但无法解决我的问题。 下载MLT解析器的各种版本zip后,我仍然无法运行它。 在eclipse中,我添加了maltparser-1.8.1.jar文件作为依赖项,并尝试从早期版本添加malt.jar但不起作用。

这是我的基本实现

import nltk
parser2 =nltk.parse.malt.MaltParser()
txt="This is a test sentence"
parser2.train_from_file('engmalt.poly-1.7.mco')
parser2.raw_parse(text)

我收到此错误:

Traceback (most recent call last):
  File "C:\Users\Mrinal\workspace\RSTParser\depParser.py", line 7, in <module>
    parser2 =nltk.parse.malt.MaltParser()
  File "C:\Python27\lib\site-packages\nltk\parse\malt.py", line 36, in __init__
    self.config_malt()
  File "C:\Python27\lib\site-packages\nltk\parse\malt.py", line 88, in config_malt
    verbose=verbose)
  File "C:\Python27\lib\site-packages\nltk\internals.py", line 544, in find_binary
    binary_names, url, verbose))
  File "C:\Python27\lib\site-packages\nltk\internals.py", line 538, in find_binary_iter
    url, verbose):
  File "C:\Python27\lib\site-packages\nltk\internals.py", line 517, in find_file_iter
    raise LookupError('\n\n%s\n%s\n%s' % (div, msg, div))
LookupError: 

===========================================================================
NLTK was unable to find the malt.jar file!
Use software specific configuration paramaters or set the MALT_PARSER environment variable.

  Searched in:
    - .

  For more information, on malt.jar, see:
    <http://www.maltparser.org/>
===========================================================================

请指导我,因为我是新手。谢谢! 还有其他解析器的任何想法,可以在Windows上轻松运行依赖解析。我试着寻找斯坦福的核心NLP,但使用它python并不是最简单的。

0 个答案:

没有答案