1

我已经从这里安装了 maltparser-1.7.2 在我的计算机的驱动器“C”中,名称为 maltparser 并设置了一个环境变量:

name=MALTPARSERHOME
value=C:\maltparser

我将maltparser目录中的maltparser-1.7.2.jar文件更改为malt.jar。之后我输入了命令(按照官方网站的说明):

java -jar malt.jar

分发已成功安装。然后我下载了预训练模型 engmalt.linear-1.7.mco 并将其提取到驱动我的电脑的“C”。之后我输入:

java -Xmx1024m -jar malt.jar -c engmalt.linear-1.7.mco -i infile.conll -o outfile.conll -m parse 

我收到以下消息:

Error occurred during initialization of VM. Too small initial heap.
I also tried by typing the commands:

java -Xmx1024m -jar malt.jar -c engmalt.linear-1.7 -i infile.conll -o outfile.conll -m parse

java -Xmx1024m -jar malt.jar -c engmalt.linear -i infile.conll -o outfile.conll -m parse

在这两种情况下,我都会收到相同的信息。谁能建议该怎么做?此外,我尝试执行以下代码:

import nltk

parser = nltk.parse.malt.MaltParser(working_dir = "C:/maltparser", mco =     "engmalt.linear-1.7")
txt = "This is a test sentence"
graph = parser.raw_parse(txt)
graph.tree().pprint()

我收到以下错误:

Traceback (most recent call last): File "C:\Users\DURLOV\My Documents\PythonWorkspace\DomainSentimentLexicon\parser.py", line 5, in graph = parser.raw_parse(txt) File "C:\Python27\lib\site-packages\nltk\parse\malt.py", line 111, in raw_parse return self.parse(words, verbose) File "C:\Python27\lib\site-packages\nltk\parse\malt.py", line 98, in parse return self.tagged_parse(taggedwords, verbose) File "C:\Python27\lib\site-packages\nltk\parse\malt.py", line 150, in tagged_parse "code %d" % (' '.join(cmd), ret)) Exception: MaltParser parsing (java -jar C:\maltparser\malt.jar -w C:/maltparser -c engmalt.linear-1.7 -i C:\maltparser\malt_input.conllxaljvi -o C:\maltparser\malt_output.conll4bt_gl -m parse) failed with exit code 1

我应该怎么办?

4

0 回答 0