반응형

 Wordcloud 만들기 


from collections import Counter
from konlpy.tag import Twitter
import pytagcloud
 
f = open('blog_data.txt')
data = f.read()
 
nlp = Twitter()
nouns = nlp.nouns(data)
 
count = Counter(nouns)
tags2 = count.most_common(40)
taglist = pytagcloud.make_tags(tags2, maxsize=80)
pytagcloud.create_tag_image(taglist, 'wordcloud.jpg', size=(900, 600), fontname='korean', rectangular=False)
 
f.close()



반응형

+ Recent posts