【发布时间】:2014-10-03 16:42:56
【问题描述】:
nltk.text.Text 的 generate 方法似乎在 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'
可能只是我记错了如何执行此操作,但是我在网上找到的所有内容似乎都支持上述方法。任何想法我做错了什么?
【问题讨论】:
-
使用 lorem ipsum Python 包。不需要 NLTK。