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:
+35
-22
@@ -66,11 +66,28 @@ def _extra_hint(cfg, dur):
|
||||
return "(额外放行区间:%s)" % ", ".join("%d~%ds" % (a, b) for a, b in ex)
|
||||
|
||||
|
||||
def resolve_lean(args, cfg):
|
||||
"""是否走 lean tags。
|
||||
|
||||
默认 prefer_lean_tags=true(少注入 RULE_NEG,避免开曲衬词)。
|
||||
--full-tags 强制完整否定句;--lean-tags 强制 lean。
|
||||
"""
|
||||
if bool(getattr(args, "full_tags", False)):
|
||||
return False
|
||||
if bool(getattr(args, "lean_tags", False)):
|
||||
return True
|
||||
return bool((cfg.get("rules") or {}).get("prefer_lean_tags", True))
|
||||
|
||||
|
||||
def assemble(args, cfg, st, lyrics_raw, title):
|
||||
"""套用铁律:生成 tags、补器乐前奏、清洗中文标记。"""
|
||||
from ..plugins.hooks import bus
|
||||
|
||||
chill = bool(getattr(args, "chill_vocal", False))
|
||||
inst = bool(getattr(args, "instrumental", False))
|
||||
lean = bool(getattr(args, "lean_tags", False))
|
||||
lean = resolve_lean(args, cfg)
|
||||
bus.emit("before_build_tags", args=args, cfg=cfg, style=st,
|
||||
chill=chill, instrumental=inst, lean=lean)
|
||||
tags = ironlaw.build_tags(
|
||||
style=st.get("style", ""), instruments=st.get("instruments", ""),
|
||||
mood=st.get("mood", ""), extra=st.get("extra", ""),
|
||||
@@ -82,8 +99,7 @@ def assemble(args, cfg, st, lyrics_raw, title):
|
||||
lyrics = ironlaw.build_inst_lyrics(
|
||||
st.get("intro_detail") or st.get("instruments"),
|
||||
bars=ibars)
|
||||
return tags, lyrics
|
||||
if chill:
|
||||
elif chill:
|
||||
# chill 走独立结构体:器乐段整体排在人声段之前。
|
||||
# 实测这只降低人声密度,并不推迟起点(chill 3 第一句仍在 0 秒),
|
||||
# 标签侧的时间/时机约束同样无效。详见 ironlaw 顶部实测结论。
|
||||
@@ -93,26 +109,23 @@ def assemble(args, cfg, st, lyrics_raw, title):
|
||||
vocal_sections(lyrics_raw),
|
||||
st.get("intro_detail") or st.get("instruments"),
|
||||
bars=ibars, total_bars=cap["total_bars"])
|
||||
return tags, lyrics
|
||||
lyrics = lyrics_raw
|
||||
if not lyrics.lstrip().lower().startswith("[intro]"):
|
||||
lyrics = ironlaw.build_lyrics(
|
||||
split_sections(lyrics_raw),
|
||||
st.get("intro_detail") or st.get("instruments"),
|
||||
bars=ibars)
|
||||
else:
|
||||
# 已有 [intro] 头的歌词文件:强制把前奏小节数对齐到标签写的值。
|
||||
# 标签写 16 小节而歌词头写 8 小节时,check_rules 会判两处不一致
|
||||
# ——这是故意留的闸门,不是 bug。
|
||||
lyrics = ironlaw.force_intro_bars(lyrics, ibars)
|
||||
# 前奏括号里的配器也要过 rhythm 过滤(2026-10-05 补)。
|
||||
# 之前这条分支只改小节数,作者手写的 [Instrumental: ...] 直接
|
||||
# 原样送进模型。ckfunk 批次的 8 首歌词前奏括号里就带着
|
||||
# "half time feel" 这类非节奏组描述,而作者也可能写 pad、
|
||||
# riser、sweep——intro_rhythm_only() 存在的全部理由就是把这些
|
||||
# 空场信号从前奏里剔掉,只留节奏组。手写歌词不等于免检。
|
||||
lyrics = ironlaw.filter_intro_bracket(lyrics)
|
||||
lyrics = "\n".join(ironlaw.strip_cn_instrumental(lyrics.splitlines())) + "\n"
|
||||
lyrics = lyrics_raw
|
||||
if not lyrics.lstrip().lower().startswith("[intro]"):
|
||||
lyrics = ironlaw.build_lyrics(
|
||||
split_sections(lyrics_raw),
|
||||
st.get("intro_detail") or st.get("instruments"),
|
||||
bars=ibars)
|
||||
else:
|
||||
# 已有 [intro] 头:对齐小节数 + 前奏括号 rhythm 过滤。
|
||||
lyrics = ironlaw.force_intro_bars(lyrics, ibars)
|
||||
lyrics = ironlaw.filter_intro_bracket(lyrics)
|
||||
lyrics = "\n".join(
|
||||
ironlaw.strip_cn_instrumental(lyrics.splitlines())) + "\n"
|
||||
out = bus.emit("after_assemble", tags=tags, lyrics=lyrics,
|
||||
args=args, cfg=cfg, style=st, lean=lean)
|
||||
if isinstance(out, dict) and out.get("tags") and out.get("lyrics"):
|
||||
return out["tags"], out["lyrics"]
|
||||
return tags, lyrics
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user