Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 NLTK 导入的数据,我可以调用text1.dispersion_plot(...),但是我无法在dispersion_plot()单词/标记列表中使用该函数。
text1.dispersion_plot(...)
dispersion_plot()
我从通过以下方式实现的纯文本开始:
tokens = nltk.word_tokenize(...)
它返回一个列表类型。
text1在 NLTK 书的上下文中是类型class 'nltk.text.Text'.
text1
class 'nltk.text.Text'
如何dispersion_plot()在自己的文本上使用和其他功能?
在使用我自己的语料库时,它应该被加载为:
myText = nltk.Text(...)
然后我可以使用其他基于类的函数,例如.concordance()等。
.concordance()