Communitygithub.com

luluoneone/japanese-subtitle-polish

日本語SRT字幕の誤字・誤変換・表記ゆれ・固有名詞・改行を、字幕の件数・番号・時刻を変えずに整える。Whisperや動画編集ソフトから書き出したSRTを、動画へ戻す前に直すときに使う。AIは修正候補(番号・原文・修正案・理由・確認根拠)だけを作り、付属スクリプトが原文と照合して適用し、件数・番号・順番・時刻の一致を検査する。「字幕を整えて」「SRTの誤字を直して」「字幕の改行を直して」などで使う。Use to proofread Japanese .srt subtitles without touching timecodes.

japanese-subtitle-polish 是什么?

japanese-subtitle-polish is a Claude Code agent skill that 日本語SRT字幕の誤字・誤変換・表記ゆれ・固有名詞・改行を、字幕の件数・番号・時刻を変えずに整える。Whisperや動画編集ソフトから書き出したSRTを、動画へ戻す前に直すときに使う。AIは修正候補(番号・原文・修正案・理由・確認根拠)だけを作り、付属スクリプトが原文と照合して適用し、件数・番号・順番・時刻の一致を検査する。「字幕を整えて」「SRTの誤字を直して」「字幕の改行を直して」などで使う。Use to proofread Japanese .srt subtitles without touching timecodes.

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add luluoneone/japanese-subtitle-polish

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Japanese Subtitle Polish(Japanese Subtitle Tidy-Up)

This Skill tidies only the text body of Japanese SRT subtitles. The AI does not rewrite the entire SRT file. The AI creates a JSON of correction candidates, and the Python scripts in scripts/ compare them against the original text, apply, and verify them.

The app.py (with a launcher) in the same folder is an app where users can drag and drop SRT files. If requested via conversation, proceed using the steps in this SKILL.md.

This file's folder is referred to as SKILL_DIR. The scripts run with only Python 3.9+ standard library (macOS/Linux: python3, Windows: python or py).

What to Maintain During Standard Operation

  • Only read the original SRT. Save the polished version as <original_name>.polished.srt.
  • Do not change the count, numbers, order, start time, or end time of subtitles. Only change the text body of each subtitle and line breaks within the text body.
  • Correct typos, mistranscriptions, inconsistent notation, and proper nouns from the specified glossary. Preserve numbers, units, negations, the strength of assertions, and the speaker's tone.
  • For items that cannot be determined without audio or source material, do not correct them; set "status": "review" (requires confirmation). Do not replace words based on guesswork to make them look natural.
  • Do not remove fillers like "えー" (um) or "あの" (uh) or summarize utterances. Only do so if the user explicitly requests it via --allow.
  • Subtitles that are too long for their display time should be reported as requiring confirmation (the script will flag them automatically) without altering the timing.
  • Splitting/merging subtitles, adjusting timing, translating, or re-listening to audio are outside the scope of this Skill. Inform the user if needed.

Procedure

1. Check Conditions

Confirm the target SRT file, whether a glossary (list of proper nouns) exists, and the intended use. If unknown, proceed with the following default values, asking only what is necessary.

Use CasePresetDescription
Video production industry standardgenbaMax 2 lines, 15 chars per line, readability guideline: 4 chars/sec
Horizontal video (default)standardMax 2 lines, 16 chars per line, readability guideline: 6 chars/sec
Readability-focused (translated subtitles, elderly viewers, etc.)safeMax 2 lines, 13 chars per line, readability guideline: 4 chars/sec
Vertical short-form videoverticalMax 2 lines, 12 chars per line, readability guideline: 6 chars/sec

The readability guideline (chars per second) is a suggestion, not a rule; it only reports subtitles that exceed it. If the user specifies a different value, use --max-cps; if they say "don't report it," use --max-cps 0.

Also confirm how to handle punctuation. The default is "keep." For use as telop (on-screen text), you can choose --punct telop to remove punctuation marks and brackets (dashes, ellipsis, !, ? are preserved. Keep characters can be changed with --punct-keep).

If the user knows the font size of the subtitles, specify --video-size 1920x1080 --font-size 80 instead of character count per line (the script calculates the max characters per line from that). See references/settings.md for counting methods and changes. See references/glossary.md for glossary creation.

2. Inspect the SRT

python3 SKILL_DIR/scripts/inspect_srt.py input.srt --glossary glossary.json --template input.candidates.json

The glossary can be either .json or .tsv. If no glossary exists, omit --glossary.

  • Outputs: structural issues, per-subtitle text body, display duration, characters per second, line-break issues, glossary matches, and hints of inconsistent notation.
  • With --template, creates a draft candidates file containing the SRT's SHA-256 and glossary-derived candidates (with IDs starting with G...).
  • If a loading error occurs, report it to the user verbatim (use --encoding cp932 for Shift_JIS).
  • Read all subtitles. If the list is long, read in segments and do not judge unread subtitles.

3. Create Correction Candidates

Judge based on the criteria in references/rules.md and append entries to the candidates key in the candidates file. Format follows references/candidates-format.md.

  • original must be copied verbatim from the inspect output. If the same string appears multiple times in the same subtitle, make it unique by including surrounding characters.
  • Always include reason (why to correct) and evidence (how you verified). Candidates missing either will not be applied.
  • For glossary-derived candidates G..., also read the context; if it's a false match, delete it or set it to review.
  • Line breaks are handled by the script at application time, so generally do not make candidates for them (the "⚠ line break" from inspect is also fixed by the script during application).
  • If you can verify the official spelling of a proper noun on the web, do so and you may include the verification URL in evidence. Otherwise, set it to review.
  • Report any issues that cannot be fixed by text correction alone (like duplicate subtitles or incorrect segmentation) with review (leave proposed empty, and type can be "other").
  • If in doubt, set review. Requiring confirmation is not a failure; it provides a list for the user to verify against audio.

4. Apply the Corrections

python3 SKILL_DIR/scripts/apply_candidates.py input.srt input.candidates.json --glossary glossary.json

If changing the preset or --punct, apply the same options to both inspect and apply. When using --punct telop, the script removes punctuation marks, so do not create candidates for punctuation marks.

  • Writes: the polished SRT, a change list, a review-required list, a review HTML (.review.html), and an application log to the same folder as the original SRT. Does not overwrite existing output files (use --overwrite for re-runs).
  • Candidates that fail matching or safety checks are not applied; they appear in the review-required list under "Unapplied correction candidates" with the reason.
    • If it's a copy-paste error of the original text, you may fix the candidate and re-run.
    • Do not set a candidate to approved based on AI judgment if it was stopped by a safety check (e.g., changes to numbers, negations, tone). Show it to the user and only set "approved": true after obtaining their approval.
  • To remove fillers or summarize, add --allow フィラー削除 / --allow 要約 only when requested by the user.

5. Verify the Results

After writing, apply automatically runs verification and displays the results (also included at the end of the change list). To run verification standalone:

python3 SKILL_DIR/scripts/verify_srt.py input.srt input.polished.srt --log input.apply-log.json

If even one item fails, tell the user not to use the polished version and investigate the cause.

6. Guide to the Review Screen

When input.review.html is opened in a browser, users can see subtitles overlaid on a video frame, the position of review-required items on a timeline, and diffs before and after correction. Users can select "Accept/Reject" for each candidate, fill in verified notation for review items, and directly edit subtitles. The screen does not rewrite the SRT. After clicking "Save Decision," input.candidates.reviewed.json is created. If requested by the user, re-run step 4 with that file using --overwrite. In the saved file, approved: true can be treated as the user's approval obtained via the screen.

7. Report

Report concisely in the following order. Do not mix machine verification results with Japanese/video confirmation.

  1. Output files (polished SRT, change list, review-required list, review HTML)
  2. Machine verification: Whether subtitle count, numbers, order, timing, BOM, and line break codes match the original. "Timing matches" refers only to this verification result.
  3. A few key corrections (before → after) and the number of subtitles where only line breaks were adjusted
  4. Review-required: Items the user should verify by listening to audio, subtitles faster than the readability guideline (not errors), subtitles exceeding the cap, and unapplied candidates
  5. What was NOT verified: Japanese meaning, readability, and synchronization with audio/video must be checked by the user by playing the polished version.

相关技能