개발모음집

.txt를 wordcloud파일로 저장하기 본문

TheRestDevelop

.txt를 wordcloud파일로 저장하기

void 2018. 6. 26. 10:00


from wordcloud import WordCloud

from os import path



def
wordCloud(self):

# Read the whole text.
text = open(path.join(FILE_PATH, '파일명.txt')).read()

# Generate a word cloud image
wordcloud = WordCloud().generate(text)

import matplotlib.pyplot as plt

plt.figure()
plt.imshow(wordcloud, interpolation="bilinear")
plt.axis("off")
plt.show()