Stop naming filler syllables in tags (they conditioned the model); default prefer_lean_tags; hard-fail intro_filler in QC; add plugins/ hook bus as thin microkernel extension point. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+54
-13
@@ -122,12 +122,15 @@ def _t_model_locked():
|
||||
|
||||
|
||||
def _t_ironlaw():
|
||||
tags = ironlaw.build_tags("Chinese pop")
|
||||
# 默认路径现与 lean 对齐:完整 RULE_NEG 用 lean=False 测
|
||||
tags = ironlaw.build_tags("Chinese pop", lean=False)
|
||||
for kw in ("swlvoice", "8 bar instrumental intro hook", "no opening vocals",
|
||||
"no pure vocal intro", "no humming",
|
||||
"no pure vocal intro", "no wordless vocals",
|
||||
"solo lead vocal only", "no backing vocals",
|
||||
"sing only the exact words"):
|
||||
assert kw in tags, "tags 缺少 %s" % kw
|
||||
for bad in ("mm mm", "ooh ooh", "wu wu wu", "en en"):
|
||||
assert bad not in tags.lower(), "tags 点名衬词音节 %s" % bad
|
||||
assert "call and response" not in tags.lower() or \
|
||||
"no call and response vocals" in tags.lower(), \
|
||||
"MEMO 仍鼓励 call and response 且未禁叠唱"
|
||||
@@ -143,12 +146,17 @@ def _t_ironlaw():
|
||||
# 中文结构标记必须被拦
|
||||
marked = lyrics.replace("[verse]", "[主歌]")
|
||||
assert ironlaw.check_rules(marked, tags), "中文结构标记未被拦截"
|
||||
# lean 也必须带衬音硬禁
|
||||
# lean 也必须带衬音硬禁,且默认配置 prefer_lean
|
||||
lean = ironlaw.build_tags("Chinese pop", lean=True)
|
||||
for kw in ("solo lead vocal only", "no backing vocals"):
|
||||
for kw in ("solo lead vocal only", "no backing vocals",
|
||||
"no wordless vocals"):
|
||||
assert kw in lean, "lean tags 缺少衬音禁令 %s" % kw
|
||||
assert "no opening vocals" not in lean.lower(), \
|
||||
"lean 不应注入 RULE_NEG 的 opening 否定堆"
|
||||
cfg = loader.load({})
|
||||
assert cfg["rules"].get("prefer_lean_tags") is True, "默认未开 prefer_lean_tags"
|
||||
return [("铁律注入",
|
||||
"8 小节前奏 + 无衬音/无和声叠唱 + lean 齐备,缺前奏/中文标记均被拦")]
|
||||
"无音节点名 + lean 默认 + 无衬音/无和声,缺前奏/中文标记均被拦")]
|
||||
|
||||
|
||||
def _t_sparse_profile():
|
||||
@@ -204,11 +212,13 @@ def _t_instrumental():
|
||||
mood="vast uplifting EDM",
|
||||
extra="male low whisper vocal, hushed and intimate",
|
||||
instrumental=True)
|
||||
# 反人声条款必须在
|
||||
# 反人声条款必须在(抽象禁令,不点名音节)
|
||||
for kw in ("no vocals anywhere", "instrumental only", "no voice at all",
|
||||
"no humming", "no choir", "no vocal sample", "swlvoice",
|
||||
"no wordless vocals", "no choir", "no vocal sample", "swlvoice",
|
||||
"8 bar instrumental intro hook"):
|
||||
assert kw in tags, "纯器乐 tags 缺少 %s" % kw
|
||||
for bad in ("mm mm", "ooh ooh", "wu wu wu"):
|
||||
assert bad not in tags.lower(), "纯器乐 tags 点名音节 %s" % bad
|
||||
# 关键回归点:风格字典的唱法描述绝不能混进来跟 "no vocals" 对撞。
|
||||
for bad in ("whisper vocal", "sparse English words", "no belting"):
|
||||
assert bad not in tags, "纯器乐 tags 混入了唱法描述: %s" % bad
|
||||
@@ -488,17 +498,16 @@ def _t_chill_no_conflict():
|
||||
"""
|
||||
tags = ironlaw.build_tags(style="s", instruments="i", mood="m",
|
||||
chill_vocal=True)
|
||||
for bad in ("no humming", "no mm mm syllables", "no oh oh syllables",
|
||||
"no droning sustained vowels"):
|
||||
for bad in ("mm mm", "ooh ooh", "oh oh syllables", "wu wu wu", "en en"):
|
||||
assert bad not in tags.lower(), \
|
||||
"chill tags 含 %s,与要求的低音语气词直接冲突" % bad
|
||||
"chill tags 点名衬词音节 %s" % bad
|
||||
# 反过来,"稀疏低音语气词"必须真的在标签里,否则就退化成纯器乐了。
|
||||
for need in ("male low whisper vocal", "low register vocal texture",
|
||||
"soft breathy phrases"):
|
||||
assert need in tags.lower(), "chill tags 丢了低音唱腔描述: %s" % need
|
||||
|
||||
return [("吟唱无冲突",
|
||||
"no humming / no mm mm / no oh oh 三条禁令未回归")]
|
||||
"未点名衬词音节,低音吟唱描述保留")]
|
||||
|
||||
|
||||
def _t_chill_integration():
|
||||
@@ -518,10 +527,12 @@ def _t_chill_integration():
|
||||
class _A(object):
|
||||
chill_vocal = True
|
||||
instrumental = False
|
||||
lean_tags = False
|
||||
full_tags = False
|
||||
|
||||
raw = open(_CHILL_DEMO, encoding="utf-8").read()
|
||||
tags2, lyrics2 = assemble(_A, cfg, st, raw, "selftest")
|
||||
errs = ironlaw.check_rules(lyrics2, tags2)
|
||||
errs = ironlaw.check_rules(lyrics2, tags2, lean=True)
|
||||
assert not errs, "chill 集成校验不通过: %s" % errs
|
||||
|
||||
# 结构核心断言:第一个有人唱的段之前,纯器乐段必须占满前半段。
|
||||
@@ -763,6 +774,35 @@ def _t_window():
|
||||
"pop/punk/urbanhiphop 的 target 区间 == check 放行窗口,边界确实生效")]
|
||||
|
||||
|
||||
def _t_plugins_and_lean_default():
|
||||
"""微内核钩子已加载;默认 prefer_lean_tags;assemble 不注入 RULE_NEG 堆。"""
|
||||
from ..plugins.hooks import bus
|
||||
assert bus._handlers.get("after_assemble"), "intro_guard 未挂 after_assemble"
|
||||
cfg = loader.load({})
|
||||
assert cfg["rules"].get("prefer_lean_tags") is True
|
||||
|
||||
class _A(object):
|
||||
chill_vocal = False
|
||||
instrumental = False
|
||||
lean_tags = False
|
||||
full_tags = False
|
||||
density_profile = None
|
||||
|
||||
st = {"bpm": 104, "duration": 180, "key": "F major",
|
||||
"style": "Chinese pop", "instruments": "kick snare bass",
|
||||
"mood": "bright", "extra": ""}
|
||||
# 密度够过闸的短样
|
||||
raw = ("[verse]\n" + "\n".join(
|
||||
["街口的灯还亮着我往前走一步"] * 20))
|
||||
tags, _ly = assemble(_A(), cfg, st, raw, "selftest")
|
||||
assert "no opening vocals" not in tags.lower(), \
|
||||
"默认 lean 仍注入了 RULE_NEG opening 堆"
|
||||
assert "no wordless vocals" in tags.lower()
|
||||
assert "mm mm" not in tags.lower()
|
||||
return [("微内核与 lean 默认",
|
||||
"plugins.after_assemble 已挂;默认 tags 为 lean 且无音节点名")]
|
||||
|
||||
|
||||
def cmd_selftest(args):
|
||||
from .common import session_logger
|
||||
cfg = loader.load({})
|
||||
@@ -773,7 +813,8 @@ def cmd_selftest(args):
|
||||
_t_intro_instrument_filter, _t_chill_no_conflict,
|
||||
_t_chill_integration,
|
||||
_t_sparse_profile, _t_lexicon,
|
||||
_t_density, _t_window, _t_regression, _t_parity, _t_fallback]
|
||||
_t_density, _t_window, _t_regression, _t_parity, _t_fallback,
|
||||
_t_plugins_and_lean_default]
|
||||
npass = 0
|
||||
print("== songforge selftest ==")
|
||||
log.info("selftest 开始", cases=len(cases))
|
||||
|
||||
Reference in New Issue
Block a user