반응형

wordcloud 패키지 설치 명령어

conda install -c conda-forge wordcloud




만약 설치후에도  오류가 발생한다면

wordcloud 패키지를 지우고 선행 패키지인 pillow 패키지를 먼저 설치한 후 wordcloud 패키지를 다시 설치한다.

 

> stylecloud 도 설치 하자. 

pip install stylecloud

 

 

 

반응형
반응형

style cloud 설정

 

> pip install stylecloud

 

 

- file_path: 입력할 데이터를 텍스트 문서로 지정합니다.

- text: 입력할 데이터를 딕셔너리 자료형으로 지정합니다.

- font_path: 워드클라우드를 그릴 path를 지정합니다.

- size: 사이즈를 지정, (1024, 512)과 같은 형식으로 입력합니다.

- background_color: 배경색을 지정한다. 색이름을 입력하면 된다. ( 예) white )

- icon_name: 어떤 모양으로 그릴 지 입력합니다. fab fa-twitter(트워터 모양), fas fa-dog(강아지), fas fa-flag(깃발), fas fa-fish(물고기) 등이 있다. 띄어쓰기 앞은 폰트를 의미하고, 뒤에는 모양을 의미한다. 그릴 수 있는 모양은 가지수가 좀 많은데, stylecolud패키지가 설치된 폴더에서 static폴더 밑에 fontawesome.min.css파일을 확인하면 알 수 있다.

- font_path: 폰트를 지정한다.

- output_name: 결과를 파일로 저장한다.

 

Generate Modern Stylish Wordcloud : towardsdatascience.com/generate-modern-stylish-wordcloud-with-stylecloud-9cbb059696d2

 

Generate Modern Stylish Wordcloud with stylecloud

But deep down, all of us have always wished for modern-stylish-beautiful wordclouds. That wish has become true with this new python…

towardsdatascience.com

파이썬 wordcloud를 사용한 한글 명사 시각화 :  liveyourit.tistory.com/58

 

파이썬 wordcloud를 사용한 한글 명사 시각화

파이썬 wordcloud는 중요한 단어나 키워드를 시각화해서 보여주는 시각화 도구이다. wordcloud 자체적으로 빈도수를 계산하는 기능이 있다고 하지만 아무래도 한글의 특성이 있다보니, 나는 한글 명

liveyourit.tistory.com

 

#워드 클라우드, 파이썬에서 이쁘게 그리는 방법은 tariat.tistory.com/854?category=678887

 

워드 클라우드, 파이썬에서 이쁘게 그리는 방법은?!

빅데이터가 많은 사람들에게 관심을 받기 시작할 때 많이 볼 수 있었던 것 중에 하나로 워드 클라우드가 있다. 워드 클라우드는 단어별 빈도수를 기준으로 한 단순한 시각화에 불과하지만, 그림

tariat.tistory.com

 

반응형
반응형

wordcloud시 불용어 지정

>pip install wordcloud


from wordcloud import WordCloud

texts = ['이것 은 예문 입니다', '여러분 의 문장을 넣 으세요']
keywords = {'이것':5, '예문':3, '단어':5, '빈도수':3}

wordcloud = WordCloud()
wordcloud = wordcloud.generate_from_text(texts)
wordcloud = wordcloud.generate_from_frequencies(keywords)

###########################################

from wordcloud import WordCloud
from wordcloud import STOPWORDS

stopwords = {'은', '입니다'}

wordcloud = WordCloud(stopwords=stopwords)
wordcloud = wordcloud.generate_from_text(texts)

keywords.pop('영화')
keywords.pop('관람객')
keywords.pop('너무')
keywords.pop('정말')

from wordcloud import WordCloud

wordcloud = WordCloud(
    width = 800,
    height = 800
)

wordcloud = wordcloud.generate_from_frequencies(keywords)

font_path = '/usr/share/fonts/truetype/nanum/NanumBarunGothic.ttf'

from wordcloud import WordCloud

wordcloud = WordCloud(
    font_path = font_path,
    width = 800,
    height = 800
)
wordcloud = wordcloud.generate_from_frequencies(keywords)



from wordcloud import WordCloud

wordcloud = WordCloud(
    font_path = font_path,
    width = 800,
    height = 800
)
wordcloud = wordcloud.generate_from_frequencies(keywords)



%matplotlib inline
import matplotlib.pyplot as plt

fig = plt.figure(figsize=(10, 10))
plt.imshow(array, interpolation="bilinear")
plt.show()
fig.savefig('wordcloud_without_axisoff.png')
from wordcloud import WordCloud, STOPWORDS
import matplotlib.pyplot as plt 
 
stopwords = set(STOPWORDS) 
stopwords.add('워드클라우드') 
 
wordcloud = WordCloud(font_path='font/NanumGothic.ttf',stopwords=stopwords,background_color='white').generate(text)
 
 

 

반응형

+ Recent posts