feat(classify): gate loose re token, non-linear negatives, drop 纯享/转场

reaction 词表用 re|reaction|反应 但须与咻咻满或充电同现,兼容 reactio/reation 等拼写又避免通用词加分;负向改为每词 -2 且命中多条额外叠加(k*(k-1)),日期 -4;纯享(误伤纯享受)移出负向,转场移出正向。库内 796 条有效视频复测:线以下由 14 降至 8。
This commit is contained in:
kairee committed 2026-11-01 19:18:20 +08:00
1 parent 337e379514
commit aa9aa7c589
8 files changed
+89 -52

No files matched your search

+20 -7
View File
@@ -74,9 +74,9 @@ _DATE_PATTERNS = (
)
_DATE_RE = re.compile("|".join(_DATE_PATTERNS))
# 负向权重(见 project.md §3.3)。正向改为「命中次数」超线性加权,见 score_item。
NEGATIVE_SCORE = 6
DATE_SCORE = 6
# 负向权重(见 project.md §3.3):每个负向词 -2,命中多条额外叠加;日期单独 -4。
NEGATIVE_PER_WORD = 2
DATE_SCORE = 4
SELF_SCORE = 3
@@ -97,16 +97,26 @@ def score_item(
正向按**命中次数**超线性加权:每命中一个正向词(``require_title`` / ``reaction``
/ ``charge`` / ``weak_positive``)记 1 次,正向得分 = 命中次数²(1→1、2→4、
3→9……),使多信号同现的真 reaction 不会被单个负向词打穿(1+1>2、1+1+1>5)。
标题不含 ``require_title`` 直接 0 分;时长只在此基础上已有命中时加权。
``reaction`` 词表含 ``re`` 这类通用子串(用于兼容 reaction/reactio/reation 等
拼写),因此必须与 ``require_title`` 或 ``充电`` 同现才计一次命中。标题不含
``require_title`` 直接 0 分;时长只在此基础上已有命中时加权。
负向按命中词数递减:每个词 -2,命中 2 个额外 -2、3 个额外 -6(k*(k-1)),
带日期再 -4。
"""
require_title = str(classify.get("require_title") or "")
if require_title and not passes_required_title(title, require_title):
return 0
# reaction 类通用词必须与 require_title 或 "充电" 同现才算命中(避免通用词加分)。
reaction_gate = passes_required_title(title, require_title) or contains_any(title, ["充电"])
reaction_hit = 1 if (matched_words(title, classify.get("reaction")) and reaction_gate) else 0
hits = 0
if require_title:
hits += 1
hits += len(matched_words(title, classify.get("reaction")))
hits += reaction_hit
hits += len(matched_words(title, classify.get("charge")))
hits += len(matched_words(title, classify.get("weak_positive")))
@@ -121,8 +131,11 @@ def score_item(
elif duration_seconds > 30 * 60:
score += gt_30
if matched_words(title, classify.get("negative")):
score -= NEGATIVE_SCORE
neg_words = matched_words(title, classify.get("negative"))
k = len(neg_words)
if k:
score -= NEGATIVE_PER_WORD * k
score -= k * (k - 1) # 命中 2 个额外 -2、3 个额外 -6、4 个额外 -12
if classify.get("date_negative", True) and date_hits(title):
score -= DATE_SCORE
if up_mid is not None and int(up_mid) == int(classify.get("self_mid", 37754047)):