def analyze(content):
# ????? ???? content ? string ??? ????
# ????? ??? nouns ?? ??? ??
nouns=t.nouns(str(content))
# ????? ??
trash=["??","????","??","??","??","??","?????"]
for i in trash:
for j in nouns:
if i==j:
nouns.remove(i)
ko=nltk.Text(nouns,name="??")
#ranking??? ??? ????? ??
ranking=ko.vocab().most_common(100)
tmpData=dict(ranking)
# ?????? ??
wordcloud=WordCloud(font_path="/Library/Fonts/AppleGothic.ttf",relative_scaling=0.2,background_color="white",).generate_from_frequencies(tmpData)
#matplotlib ?????? ?? ??????? ??? ???? ???
plt.figure(figsize=(16,8))
plt.imshow(wordcloud)
plt.axis("off")
plt.show()
# ??? ??(??? ????? ???? ???? ? ?????? ??? ??)
评论列表
文章目录