soojeongcrystal commited on
Commit
c5f06cc
·
verified ·
1 Parent(s): 25dec24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -4
app.py CHANGED
@@ -5,7 +5,6 @@ from sklearn.feature_extraction.text import CountVectorizer
5
  from sklearn.decomposition import LatentDirichletAllocation
6
  from konlpy.tag import Okt
7
  import re
8
- from hanspell import spell_checker
9
  import warnings
10
 
11
  # 경고 메시지 무시
@@ -16,8 +15,6 @@ default_stopwords = set(["있다", "없다", "것", "그", "이", "하는", "하
16
 
17
  @st.cache_data
18
  def preprocess_text(text, user_stopwords):
19
- text = spell_checker.check(text).checked # 맞춤법 검사
20
-
21
  okt = Okt()
22
  text = re.sub(r'[^\w\s]', '', text) # 특수 문자 제거
23
  nouns = okt.nouns(text) # 명사 추출
@@ -36,7 +33,7 @@ def topic_modeling(texts, n_components):
36
  return topics
37
 
38
  def generate_wordcloud(text, color):
39
- wordcloud = WordCloud(width=800, height=400, background_color=color).generate(text)
40
  fig, ax = plt.subplots(figsize=(10, 5))
41
  ax.imshow(wordcloud, interpolation='bilinear')
42
  ax.axis("off")
 
5
  from sklearn.decomposition import LatentDirichletAllocation
6
  from konlpy.tag import Okt
7
  import re
 
8
  import warnings
9
 
10
  # 경고 메시지 무시
 
15
 
16
  @st.cache_data
17
  def preprocess_text(text, user_stopwords):
 
 
18
  okt = Okt()
19
  text = re.sub(r'[^\w\s]', '', text) # 특수 문자 제거
20
  nouns = okt.nouns(text) # 명사 추출
 
33
  return topics
34
 
35
  def generate_wordcloud(text, color):
36
+ wordcloud = WordCloud(width=800, height=400, background_color=color, font_path='/usr/share/fonts/truetype/nanum/NanumGothic.ttf').generate(text)
37
  fig, ax = plt.subplots(figsize=(10, 5))
38
  ax.imshow(wordcloud, interpolation='bilinear')
39
  ax.axis("off")