Membuat Fancy Workcloud Detective Conan Menggunakan Python

Sneak peek Detective Conan chapter 1061; lihatlah ekspresi semua agen FBI tersebut. I can’t wait the next chapter.
Word cloud default
  1. Word cloud yang di mask ke PNG Conan
# save mask to conan_mask
conan_mask = np.array(Image.open('data/mask/conan.png'))
# instantiate a word cloud object
conan_wc = WordCloud(background_color='white', max_words=2000, mask=conan_mask, stopwords=stopwords, colormap='twilight')
# generate the word cloud
conan_wc.generate(conan_text)
# display the word cloud
fig = plt.figure()
fig.set_figwidth(14) # set width
fig.set_figheight(18) # set height
plt.imshow(conan_wc, interpolation='bilinear')
plt.axis('off')
plt.show()
Word cloud yang di mask di gambar Conan
# create coloring from image
image_colors = ImageColorGenerator(conan_color)
wc.recolor(color_func=image_colors)
Gambar asli
Word cloud yang dengan warna dari gambar asli di atas

--

--

Product manager | Data enthusiast

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store