现在删除的模块'nltk.model.NGramModel'是否有替代方案? [英] Is there an alternate for the now removed module 'nltk.model.NGramModel'?

查看:139
本文介绍了现在删除的模块'nltk.model.NGramModel'是否有替代方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经连续两天试图寻找替代方法,但是找不到任何相关的方法. 我基本上是想获得一个合成句子的概率分数(通过替换从语料库中选取的原始句子中的某些单词来进行合成).

I've been trying to find out an alternative for two straight days now, and couldn't find anything relevant. I'm basically trying to get a probabilistic score of a synthesized sentence (synthesized by replacing some words from an original sentence picked from the corpora).

我尝试过并置",但是获得的分数并没有很大帮助.因此,我尝试利用语言模型的概念,只是发现由于某些错误,已从NLTK中删除了看似有用的模块模型".

I tried Collocations, but the scores that I'm getting aren't very helpful. So I tried making use of the language model concept, only to find that the seemingly helpful module 'model' has been removed from NLTK because of some bugs.

如果有人可以让我知道在python中获取ngram模型实现的另一种方法,或者更好的是,建议我以其他方法解决对句子评分的问题,那将是非常不错的. /p>

It'd be really great if someone could either let me know about some alternate way to get the ngram model implementation in python, or better yet, suggest me some other way to solve the problem of 'scoring' the sentence.

推荐答案

根据此公开问题nltk存储库NGramModel当前不在主目录中,因为存在一些错误.他们当前的解决方案是从模型分支安装代码.但是,这比master落后了大约8个月,因此您可能会错过其他功能和错误修复.

According to this open issue on the nltk repo, NGramModel is currently not in master because of some bugs. Their current solution is to install the code from the model branch. This is about 8 months behind master though, so you might miss out on other features and bug fixes.

pip install https://github.com/nltk/nltk/tarball/model

相关代码位于模型分支的 .如果您不想使用过时的分支,可以将其复制到本地代码中.如果您真的很想使用它,可以尝试修复突出的错误并提交拉取请求.

The relevant code is here in the model branch. You could copy this to your local code if you don't want to use the outdated branch. If you really care about using this you could try to fix the outstanding bugs on it and submit a pull request.

这篇关于现在删除的模块'nltk.model.NGramModel'是否有替代方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆