Skip to content

修复中文字幕在小数和科学计数法中间断行 - #30

Merged
EveningStudy merged 2 commits into
EveningStudy:mainfrom
rayw-lab:codex/subtitle-number-wrapping
Nov 24, 2026
Merged

EveningStudy merged 2 commits into
EveningStudy:mainfrom
rayw-lab:codex/subtitle-number-wrapping

Conversation

@rayw-lab

Copy link
Copy Markdown
Contributor

解决的问题

中文台词没有空格,导出 SRT 时,原来的断行器可能从数字中间切开一行。例如使用默认的 22 字行宽导出「我们测得阿伏伽德罗常数约为6.02214076×10²³每摩尔」,第一行结尾是「6.0221407」,第二行从「6×10²³」开始。录音时长和带正负号的分贝数也可能遇到相同的问题。

改动范围

在含汉字的字幕行中,若整数、小数或科学计数表达式能完整放入一行,遇到行界就把它整体移到下一行。超出整行宽度的数值继续按原规则折行,避免超宽。加入了 ASCII 与 Unicode 负号、过长数字、英文、SRT 时码和 LRC 导出的回归用例,并更新中英文变更记录。

验证结果

  • Linux arm64 容器、Python 3.12,按锁文件安装开发依赖后,完整运行 pytest tests/test_subtitles.py,23 项全部通过。macOS 中 20 项通过,另 3 项触发应用的平台检查。本地未运行整个项目测试套件。
  • Ruff 检查和格式、Pyright、ModelScope 制品检查通过。
  • 已在未发布的变更记录中更新说明。此次没有界面、按钮或截图改动。
  • 无设置、表格或项目数据改动。
  • 已用默认 22 字行宽实测上述例句。导出路径的自动测试同时核对 SRT 时间和 LRC 文本。GPU 配音及完整图形界面未在本次验证范围内。
  • 提交只包含断行代码、回归测试和两份变更记录。

风险边界

只影响字幕显示时的断行位置。沿用现有行宽上限、纯英文的文本换行和超长数值回退。安装器、下载源、模型或其他依赖、设置与项目格式、网络请求、凭据和 GPU 处理均无变更。Windows 上的实际运行由上游 CI 核验。

界面改动

不适用。

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T05:08:52.694549Z 776ff04 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@EveningStudy EveningStudy reopened this Nov 24, 2026
@EveningStudy
EveningStudy merged commit 1bbe6ae into EveningStudy:main Nov 24, 2026
4 checks passed
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