|
@@ -49,6 +49,10 @@ def exists_ztb(contents: dict):
|
|
# 切词
|
|
# 切词
|
|
for no_key, content in contents.items():
|
|
for no_key, content in contents.items():
|
|
source = replace_word(content)
|
|
source = replace_word(content)
|
|
|
|
+ if not source:
|
|
|
|
+ result[no_key] = 0
|
|
|
|
+ continue
|
|
|
|
+
|
|
texts = deal_tag_a(source)
|
|
texts = deal_tag_a(source)
|
|
space_contents = cut_data(texts)
|
|
space_contents = cut_data(texts)
|
|
if not space_contents:
|
|
if not space_contents:
|
|
@@ -56,6 +60,7 @@ def exists_ztb(contents: dict):
|
|
continue
|
|
continue
|
|
body.append(space_contents)
|
|
body.append(space_contents)
|
|
id_list.append(no_key)
|
|
id_list.append(no_key)
|
|
|
|
+
|
|
# 生成预测结果
|
|
# 生成预测结果
|
|
predict_threshold = topic_model.predict(body, threshold=True)
|
|
predict_threshold = topic_model.predict(body, threshold=True)
|
|
for no_key, pre_ret in zip(id_list, predict_threshold):
|
|
for no_key, pre_ret in zip(id_list, predict_threshold):
|