Skip to content

fix: 修复尾随和声拆分及注音、翻译对齐边界 - #9

Merged
imsyy merged 1 commit into
mainfrom
feat/lyric-parsing-edge-fixes
Sep 24, 2026
Merged

imsyy merged 1 commit into
mainfrom
feat/lyric-parsing-edge-fixes

Conversation

@imsyy

@imsyy imsyy commented Sep 24, 2026

Copy link
Copy Markdown
Member

修复尾随和声左括号位于词中间时正文被划入和声的问题,保留括号前的文本及其时间跨度,并支持左括号位于第一个词内、同词包含主唱与和声、日文注音保护等情况。对缺少词内时间信息的片段沿用原始时间跨度。

同时完善 #5、#7、#8 的边界行为:数字串的注音覆盖整个数字串;QRC/KRC 外部 kana 在康熙部首归一化前对齐;LRC 过滤翻译占位符后仍保留罗马音的字段位置。

新增 12 个回归用例,包含 #4 的真实 QRC 样例。验证通过:229 个测试、pnpm lint、pnpm typecheck、pnpm build。

Closes #4

Copilot AI lite review requested due to automatic review settings September 24, 2026 07:31
@imsyy
imsyy merged commit 1719ee2 into main Sep 24, 2026
2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

LRC placeholder handling can still misplace romanization when multiple placeholders share a timestamp.

Review effort: Lite
Findings: None

What changed in this PR

Fixes trailing harmony splitting and kana/translation alignment edge cases across QRC, KRC, and LRC parsing.

Changes:

  • Improves in-word harmony splitting and timing preservation.
  • Corrects numeric kana and external kana alignment.
  • Adds regression tests for reported edge cases.
File Summary
tests/​parsing-regressions.spec.ts Adds regression coverage.
src/​utils/​kana.ts Fixes kana timing across numeric strings.
src/​utils/​bg.ts Improves in-word trailing harmony splitting.
src/​parse/​lrc.ts Handles translation and romanization slot alignment.
src/​parse/​index.ts Defers Kangxi normalization during kana alignment.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

尾随和声拆分错误

2 participants