【问题标题】:How to use Python to use stanford parser dealing with chinese sentence如何使用 Python 使用 stanford parser 处理中文句子
【发布时间】:2015-01-27 22:55:10
【问题描述】:

我想用python的接口来处理一些中文句子,因为我对Java没有任何了解。 问题来了。官网给出的界面好像只能用英文句子。我尝试修改parser.py中的代码,但遇到了很多困难。 所以,我想知道你们中是否有人像我一样遇到过这样的问题,可以给我一些关于如何应对它的想法吗? 非常感谢。

【问题讨论】:

  • 请澄清您的具体问题或添加其他详细信息以准确突出您的需求。请参阅How to Ask page 以获得澄清此问题的帮助。

标签: python stanford-nlp chinese-locale


【解决方案1】:

您应该可以使用NLTK's StanfordParser interface。请参阅this other SO answer 中有关使用来自 NLTK 的解析器的介绍。

只需将中文模型提供给StanfordParser init 方法即可:

# ... set up parser JAR paths here ...
parser = stanford.StanfordParser(model_path="edu/stanford/nlp/models/lexparser/chinesePCFG.ser.gz")
# ... parse things ...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-06
    • 1970-01-01
    • 2015-06-17
    • 1970-01-01
    • 2014-07-11
    • 1970-01-01
    相关资源
    最近更新 更多