2014-10-03 56 views
12

nltk.text.Text的生成方法似乎已在NLTK 3.0中刪除。如何在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' 

這可能只是我記憶錯誤如何做到這一點,但一切我可以在網上找到,似乎支持上述方法。任何想法我做錯了什麼?

+0

使用lorem ipsum Python包。不需要NLTK。 – mac389 2015-03-03 23:31:41

回答