gpt4 book ai didi

python - 在 NLTK 中使用预训练的 MaltParser 模型

转载 作者:太空狗 更新时间:2023-10-30 01:16:57 28 4
gpt4 key购买 nike

谁能告诉我如何在 nltk.parse.malt 中使用预训练的 MaltParser 模型 (http://maltparser.org/mco/english_parser/engmalt.html)?唯一的选择似乎是从文件中训练(如果有人能指出一个好的、公开可用的训练文件的方向,那也太好了)。

最佳答案

旧版本 NLTK 中的 MaltParser 接口(interface)用于对模型路径进行硬编码。这已在提交 e9e443 中修复.您现在可以执行以下操作:

maltparser = MaltParser(mco="/path/to/your/model.mco")

截至撰写本文时,easy_install 和 pip 仍在安装不包含此修复程序的 NLTK 版本 (2.0.1rc4)。如果您负担不起切换到最新版本的费用,则可以使用以下 hack:

maltparser = MaltParser()
maltparser.mco = "/path/to/your/model.mco"

可以在 MaltParser's official website 上找到预训练模型.

关于python - 在 NLTK 中使用预训练的 MaltParser 模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9027369/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com