簡體   English   中英

使用nltk時dict_keys對象沒有屬性圖

[英]dict_keys object has no attribute plot while using nltk

我在用

python 3.6(Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32)

使用python3.6在nltk上工作時,當我嘗試獲取頻率分布圖時,出現錯誤。

嘗試以下腳本

from nltk.book import *

freq = FreqDist(text5)
freq12 = freq.keys()
freq12.plot(50, cumulative=True)

我收到以下回溯

Traceback (most recent call last):
  File "<pyshell#52>", line 1, in <module>
    freq12.plot(50, cumulative=True)
AttributeError: 'dict_keys' object has no attribute 'plot'

使用python 3.6時如何獲取圖?

我從未使用過該庫,但是我認為是基於其他問題進行猜測的

freq12.plot(50, cumulative=True)

應該

freq.plot(50, cumulative=True)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM