如何在NLTK 3.0中生成随机文本? [英] How do I generate random text in NLTK 3.0?

查看:73
本文介绍了如何在NLTK 3.0中生成随机文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

nltk.text.Text的生成方法似乎已在NLTK 3.0中删除.

The generate method of nltk.text.Text seems to have been removed in NLTK 3.0.

例如:

>>> bible = nltk.corpus.gutenberg.words(u'bible-kjv.txt')
>>> bibleText = nltk.Text(bible)
>>> bibleText.generate()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Text' object has no attribute 'generate'

可能只是我记错了如何执行此操作,但是我在网上可以找到的所有内容似乎都支持上述方法.有什么想法我做错了吗?

It may just be that I'm remembering wrongly how to do this, but everything I can find online seems to support the above method. Any ideas what I'm doing wrong?

推荐答案

generate()方法在NLTK 3.0中不可用,但是将 在后续版本中恢复.

The generate() method is not available in NLTK 3.0 but will be reinstated in a subsequent version.

这篇关于如何在NLTK 3.0中生成随机文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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