1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # # µû¶óÇÏ¸ç ¹è¿ì´Â ÆÄÀ̽ã°ú µ¥ÀÌÅÍ°úÇÐ(»ý´ÉÃâÆÇ»ç 2020) # 9.7 Á¤º¸¸¦ ÇÑ´«¿¡ º¸¿©ÁÖ´Â ¿öµå Ŭ¶ó¿ìµå , 232ÂÊ # import wikipedia # À§Å°¹é°ú »çÀüÀÇ ÄÁÅÙÃ÷ Á¦¸ñÀ» ¸í½ÃÇØ ÁØ´Ù wiki = wikipedia.page('Artificial intelligence') # ÀÌ ÆäÀÌÁöÀÇ ÅؽºÆ® ÄÁÅÙÃ÷¸¦ ÃßÃâÇϵµ·Ï ÇÑ´Ù text = wiki.content ################################################### from wordcloud import WordCloud # ¿öµå Ŭ¶ó¿ìµå¸¦ »ý¼ºÇϱâ À§ÇØ À§ÀÇ Äڵ带 »ðÀÔÇÒ °Í wordcloud = WordCloud(width = 2000, height = 1500).generate(text) #################################################### ####### from wordcloud import WordCloud, STOPWORDS # ÁßÁö¾î°¡ Á¦¿ÜµÈ ¿öµå Ŭ¶ó¿ìµå¸¦ ¸¸µéÀÚ s_words = STOPWORDS.union( {'one', 'using', 'first', 'two', 'make', 'use'} ) wordcloud = WordCloud(width = 2000, height = 1500, stopwords = s_words).generate(text) import matplotlib.pyplot as plt plt.figure(figsize=(40, 30)) # ȸ鿡 À̹ÌÁö¸¦ ±×·ÁÁØ´Ù plt.imshow(wordcloud) plt.show() | cs |