diff --git a/main.py b/main.py index d182746a3bfb34a70865ae4e72992d5e50e2e78e..39d95fa6fb5cf7862f8c56f96eb223e574fc6794 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,6 @@ import pandas as pd import os -import jieba +from snownlp import SnowNLP CONST_COLUMN_WORDS_COUNT = '词数' @@ -28,7 +28,7 @@ def build_row_counts(txt_file, keywords): counts = {} for keyword in keywords: if keyword == CONST_COLUMN_WORDS_COUNT: - seg_list = jieba.cut(content) + seg_list = SnowNLP(content) counts[keyword] = sum(1 for _ in seg_list) else: counts[keyword] = content.count(keyword)