Skip to content

Commit

Permalink
Merge pull request #370 from Jasonyang2014/wordcloud-filter-whitespace
Browse files Browse the repository at this point in the history
词云过滤空白字符
  • Loading branch information
NanmiCoder authored Aug 6, 2024
2 parents 1c2237a + fc16ab7 commit 85727da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/words.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def load_stop_words(self):

async def generate_word_frequency_and_cloud(self, data, save_words_prefix):
all_text = ' '.join(item['content'] for item in data)
words = [word for word in jieba.lcut(all_text) if word not in self.stop_words]
words = [word for word in jieba.lcut(all_text) if word not in self.stop_words and len(word.strip()) > 0]
word_freq = Counter(words)

# Save word frequency to file
Expand Down

0 comments on commit 85727da

Please sign in to comment.