Skip to content

Commit 1e2472f

Browse files
fix(translator): add strict CJK split boundary constraints to system prompt
1 parent b0387b1 commit 1e2472f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/bilingualsub/core/translator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,10 @@ def _build_translator_description(
174174
"3. 字幕可能在句子中間被截斷,這是正常的,請依照上下文理解完整語意後翻譯。\n" # noqa: RUF001
175175
"4. 重要:如果相鄰的編號字幕在語意上屬於同一個完整句子," # noqa: RUF001
176176
"請先將它們合併為一個整體進行翻譯,再將翻譯後的中文合理地拆分並分配回對應的編號行中。" # noqa: RUF001
177-
"必須確保拆分後的行與行之間中文語意銜接流暢、自然,且符合中文文法習慣" # noqa: RUF001
178-
"(例如:避免在下一行的開頭出現『的』、『的問題』、『的...』等突兀、不流暢的斷句," # noqa: RUF001
179-
"通常可將『的』留在前一行的結尾)。" # noqa: RUF001
177+
"必須確保拆分後的行與行之間中文語意銜接流暢、自然,且符合中文文法習慣。\n" # noqa: RUF001
178+
"5. 絕對限制:中文的結構助詞『的』必須緊貼在修飾語後方," # noqa: RUF001
179+
"因此絕對禁止將『的』單獨拆分到下一行的開頭,亦禁止在任何行首以『的』、『的問題』、『的...』開頭。" # noqa: RUF001
180+
"若有此狀況,必須將『的』移至上一行的結尾(例如:第一行結尾為『...的』,第二行開頭為『問題...』)。" # noqa: RUF001
180181
)
181182
metadata_section = _build_metadata_section(video_title, video_description)
182183
result = base

0 commit comments

Comments
 (0)