2013-07-02 18 views
3

使用NLTK導入的數據,我可以做text1.dispersion_plot(...),但是我無法在單詞/標記列表上使用dispersion_plot()函數。使用NLTK,如何獲得列表的散佈圖?

我開始了與實現純文本:

令牌= nltk.word_tokenize(...)

它返回一個列表類型。

text1在NLTK書的背景是class 'nltk.text.Text'類型。

如何在我自己的文本上使用d ispersion_plot()和其他功能?

+0

看看'nltk.draw .dispersion.dispersion_plot' – michaelmeyer

回答

4

在用自己的語料庫,應該加載:

myText = nltk.Text(...) 

我可以再使用額外的基於類的功能,如.concordance()