Dependency Parsing using MaltParser and NLTK

百般思念 提交于 2019-12-11 03:39:55

问题


Consider the sentence

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

I'm trying to parse this sentence by using malparser and NLTK as follows:

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())

The result is

(. PeterParker loves MaryJane)

but the correct answer should be:

(loves PeterParker MaryJane .)

Is there something that I'm doing wrong here? Does anyone could help me?

来源:https://stackoverflow.com/questions/23463519/dependency-parsing-using-maltparser-and-nltk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!