Task Objective
Clean the raw srt provided by the user into a deliverable complete clean.srt。
- Do not overwrite the original subtitle file.
- Only perform subtitle-level error correction; do not polish, summarize, or expand.
- Final validation: directly run on the original
srtand the completeclean.srtrunscripts/check_clean_srt.py。
Original Requirements
Text Cleaning Requirements
- Correct recognition errors, including correct “的、地、得” and reasonable “他、她、它”.
- Delete meaningless filler words such as “嗯、啊、呃、哈”; the cleaned subtitles should not contain punctuation.
- Necessary spaces/pauses are required between clauses.
Example:
来那你就先开始->来 那你就先开始Example:你是第二个是吧->你是第二个 是吧 - Delete obviously repeated words; do not rewrite in a formal style, do not summarize, do not expand; only perform subtitle-level cleaning and error correction.
- Each subtitle must not exceed 14 characters (English words are treated as one character by default), and there should be no line breaks within a single subtitle.
- If the original subtitle exceeds 14 characters, accurate sentence segmentation and splitting must be performed.
Example:
还得谢谢各位母亲对家里的付出->还得谢谢各位母亲+对家里的付出 - Do not cause subsequent subtitles to shift earlier or later overall due to text error correction, deletion of filler words, deletion of repeated words, or subtitle splitting. All adjustments should be limited to the current subtitle entry and its local scope.
Timeline Requirements
- The processed subtitles must be strictly synchronized with the original audio, and no global time drift may occur.
- If only subtitle-level cleaning and error correction are performed, and the semantic boundaries of the original sentence are not changed, then by default keep the original start and end times of that entry unchanged.
- If splitting is due to sentence segmentation or a single entry exceeding 14 characters, then all split sub-entries must fall completely within the original subtitle time range; sub-entries must not overlap, should preferably connect end-to-start, and the total covered duration must be consistent with the original entry.
- The time allocation after splitting should be based preferentially on semantic pauses and speaking rhythm; when this cannot be determined precisely, then allocate proportionally according to the number of effective characters in each clause; do not mechanically divide equally.
- When deleting filler words within a sentence or obviously repeated words, usually do not adjust the start and end times of the original entry; if an entry itself is merely an independent and meaningless filler word, it may be deleted directly, but do not stretch the coverage of surrounding subtitles without basis.
- Each subtitle should fit the speech segment as closely as possible and must not be hung obviously early or linger; if fine-tuning is needed, the deviation of a single subtitle’s start and end times relative to the speech boundary should be kept within ±100 to 150 milliseconds as much as possible.
- After splitting and deletion/modification, readability must still be ensured, avoiding overly short flashes, obvious missed attachments, meaningless gaps, or segmentation that breaks natural semantic boundaries.
Additional Requirements
- Do not mistakenly delete meaningful subtitle entries.
- The timeline must be double checked.
- If the subtitle file is too long, parallelize only when the user explicitly requests or allows parallel sub-agents; even if parallelized, treat parallelism only as an editing aid, and the main agent must still directly produce a complete
clean.srt。 - The script should not assume that subtitle splitting definitely occurred; both no splitting and splitting must be compatible.
Working Principles
- Only perform subtitle-level cleaning and correction, and do not make written-style rewrites, summaries, or expansions. Unless it is truly an error, a filler word, an obvious repeated slip of the tongue, or required by the rules, do not delete colloquial expressions.
- Conservative priority. Unless it can be clearly determined to be an ASR recognition error, a meaningless filler word, an obvious repeated slip of the tongue, a missing necessary pause space, or something that must be split because it exceeds 14 characters, do not rewrite the original sentence order, syntactic structure, collocation relationships, or replace it with a smoother wording.
- Do not rewrite the original sentence merely because it is "smoother," "more concise," or "more like written language." For example, changing "give me support" to "support me," "say to me" to "tell me," or "is also is" to "is also," if it is not a clear recognition error or required by the rules, do not change it at all.
- Subtitles are allowed to be less written and less polished; only fix errors, do not polish. If a sentence already satisfies the rules in its current form, keep it as is.
- Deletion rules are strict. Standalone entries consisting purely of filler words may be deleted directly; apart from that, deleting an entire entry is allowed only when it can be clearly determined to be a broken fragment, a repeated fragment, or pure noise misrecognition. All non-filler deletions must be organized into an allowlist and listed one by one in the delivery.
- If the user separately specifies the character-counting basis, for example "an English word counts as one character," the user's requirement takes precedence; if the script's default basis is inconsistent with the user's requirement, explain the script's limitations and the actual review method used in the delivery.
- If the user separately specifies the character-counting basis, for example "an English word counts as one character," the user's requirement takes precedence; when running the validation script, you may add
--latin-word-as-one-char。 - The default complete output
clean.srtshould prioritize verifiability and listen-back. Unless the user explicitly requests renumbering, prefer to keep the originalblock_id; when splitting a single entry, use123a、123bthis kind of temporary numbering. - Do not borrow words across entries, add words, or rewrite to "smooth out" the current entry. If the current entry is unclear or suspected of ASR confusion, but cannot be clearly corrected based only on this entry, prefer to keep the original sentence and mark it for manual re-listening; do not subjectively splice new text from the surrounding subtitles.
Output conventions
- The default output filename is in the form
xxx.clean.srt。 - Do not overwrite the original file.
- The final deliverable is a complete
clean.srt; do not treat "block files to be merged" as the formal product. - If, for validation or editing convenience, it is necessary to retain the original numbering after splitting, you may directly use it in the complete
clean.srtuse123a、123b; do not additionally rely on a merge script to reassemble them a second time.
Recommended workflow
- Read the original
srt, confirm the total number of entries, whether there are overly long entries, and whether block processing is needed. - Clarify the counting basis for this character constraint; if the user provides no additional explanation, check according to the script basis by default.
- Perform cleaning, correction, necessary splitting, and timeline control entry by entry, and directly organize them into a complete
clean.srt。 - If the file is very long and the user permits parallel processing, it may be assigned to subagents by subtitle number or time range, but the main agent must ultimately manually integrate it into a complete
clean.srt, and do not rely on a merge script. - For non-filler deleted entries, first organize an allowlist.
- Run
scripts/check_clean_srt.pyto perform rule checks and timeline review. - Manually review warnings, focusing on residual filler words, residual repeated slips of the tongue, possible missing pause spaces, overly short flashes, text misalignment, and the allowlist.
Script resources
scripts/check_clean_srt.py
Used to check the complete clean.srt whether it meets the requirements for length, punctuation, timeline, deleted entries, local split boundaries, etc. This script should be independently runnable.
This script must be compatible with two types of input:
- complete but unsplit
clean.srt。 - complete and containing local split entries
clean.srt, allowing the use of123a、123bsuch temporary numbering.
Common usage:
python3 scripts/check_clean_srt.py raw.srt clean.srt
python3 scripts/check_clean_srt.py raw.srt clean.srt --allowed-deletions '284,415,450'
python3 scripts/check_clean_srt.py raw.srt clean.srt --allowed-deletions '284,415,450' --fail-on-warnings
python3 scripts/check_clean_srt.py raw.srt clean.srt --latin-word-as-one-char
Delivery requirements
When delivering, at least explain:
- Output file path
- Whether the original file is kept and not overwritten
- Whether there are entries allowed to be deleted
- Whether the validation script was executed
- Whether there are still warning sites that require manual re-listening and review