叫法消毒按词认判断词(scan bare):说法核对修复后 scan 缺省按整句规矩认(没说变化的「主要来自」不算判断),叫法是一个名字不是一句话,「主要来自华东的销售额」这样的叫法要整个不要

This commit is contained in:
ThearchyHelios
2026-10-21 17:12:48 +08:00
parent a02dc41424
commit 24b5aebae4
2 changed files with 17 additions and 2 deletions
+3 -2
View File
@@ -219,10 +219,11 @@ def _shorten(text: str) -> str:
def _judges(text: str) -> bool:
"""叫法里有没有说法表的判断词(「主要来自」「历史新高」……)。说法核对在 engine 里,在这里导入免得循环导入。"""
"""叫法里有没有说法表的判断词(「主要来自」「历史新高」……)。说法核对在 engine 里,在这里导入免得循环导入。
叫法是一个名字不是一句话,按词认(bare):整句话才成立的那些不核的规矩(没说变化的构成、建议计划……)不用。"""
from app.engine.analysis_claims import scan
return bool(scan(text))
return bool(scan(text, bare=True))
def _scrub(text: str) -> str:
@@ -0,0 +1,14 @@
"""叫法消毒按词认判断词(scan bare):叫法是一个名字,整句话才成立的不核规矩(没说变化的「主要来自」不算判断)对它不适用。"""
from __future__ import annotations
from app.analysis.phrases import clean_label
def test_a_label_that_carries_a_judgement_without_a_change_word_is_still_refused():
assert clean_label("主要来自华东的销售额") == ""
assert clean_label("集中在周末的订单数") == ""
def test_plain_labels_survive():
assert clean_label("销售额") == "销售额"
assert clean_label("线上订单数") == "线上订单数"