使用MaltParser和NLTK进行依赖性解析

时间:2014-05-05 01:22:24

标签: parsing dependencies nltk

考虑句子

new_sent = '''PeterParker loves MaryJane.'''

我正在尝试使用malparser和NLTK解析这句话,如下所示:

maltParser = nltk.parse.malt.MaltParser(working_dir="/Applications/maltparser-1.7.2", 
                                        mco="engmalt.linear-1.7",
                                        additional_java_args=['-Xmx1024m'])
graph = maltParser.raw_parse(new_sent)
print(graph.tree().pprint())

结果是

(. PeterParker loves MaryJane)

但正确的答案应该是:

(loves PeterParker MaryJane .)

我有什么问题吗?有人能帮助我吗?

0 个答案:

没有答案