feat: 增强 CJK 歌词语言处理逻辑 - #240
Open
MoYingJi wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
新增逻辑中存在可导致 TypeScript 编译错误与 ruby 文本未被正确纳入检测的明确 bug,需要先修复后再合入。
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
本 PR 旨在改进歌词行语言标注(LyricLine.language)的 CJK 语言推断逻辑,通过引入「假名/谚文行数占比阈值」与「翻译启发式」来降低误判,并计划把 ruby 注音也纳入检测文本以覆盖更多边界情况。
Changes:
- 新增基于
kanaLineCount / hanLineCount、hangulLineCount / hanLineCount的比例阈值推断主 CJK 语言(THRESHOLD = 0.37)。 - 保留并调整“全假名/全谚文行均有翻译”启发式,用于区分双语混合歌词中的纯汉字行。
- 将 ruby 内容合并到行文本中参与脚本检测(当前实现存在类型拼接问题,需要修复)。
File summaries
| File | Description |
|---|---|
| src/utils/lyric/language.ts | 调整歌词行语言推断:引入比例阈值与 ruby 参与检测,并重构纯汉字行的语言判定逻辑 |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
MoYingJi
force-pushed
the
pr/feat/lang
branch
from
September 6, 2026 01:55
bb71b5e to
e5a196a
Compare
MoYingJi
marked this pull request as ready for review
September 6, 2026 01:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动类型
是否包含破坏性变更
改动说明
原先的根据翻译的启发式判断还是会误判某些情况,比如由 kid141252010 反馈的 《等你的回答》,这首歌仅有开头的制作人有谚文,但却被整首歌判为韩语
此 PR 增加了判断包含假名或谚文的行与包含汉字的行的比值是否超过阈值判断 CJK 的主语言,避免了这种情况下的误判。除此之外,也将 ruby 内容也算作歌词内容的一部分,以考虑纯汉字行但 ruby 为假名的情况
比例的阈值
THRESHOLD = 0.37是我根据 《人是猫》 的12 / 33 ≈ 0.3636363636猜的,是否适用于所有情况还未知自查清单
pnpm format,并确认pnpm typecheck、pnpm lint通过pnpm build:native验证;未手写native/*/index.d.tsdev分支提交