txt-zh-bilingual
Translate English .txt files into Chinese and produce sentence-aligned bilingual JSON with merging of short English sentences. Use when asked to batch-convert text files into [{"en","zh"}] arrays, split/merge sentences, or generate JSON alongside original .txt files.
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
Txt Zh Bilingual
Overview
Convert English .txt files into bilingual JSON arrays, with sentence splitting, merging of short English sentences, and Chinese translation for each aligned segment.
Workflow
1. Translate the full text first (AI-guided)
Read the entire .txt file and produce a coherent, natural Chinese translation of the full content. Fix line breaks, captions, or fragmentary lines in Chinese so the narrative flows.
Guidelines:
- Preserve tone, pacing, and speaker intent.
- Keep technical terms and product names consistent.
- Do not force sentence-by-sentence alignment at this stage.
2. Build English sentence segments
Reconstruct complete English sentences from the raw lines. Merge broken fragments and normalize punctuation.
Guidelines:
- Merge fragments split by newlines into complete sentences when they belong together.
- Preserve intentional short lines only when they are standalone utterances (e.g., sound cues, one-word reactions, quoted asides).
- If a line is obviously a continuation (starts with conjunctions like "and", "but", "so", or lowercase), merge it into the previous segment.
- If punctuation is missing but the meaning clearly continues, merge until the thought completes.
- Keep each
ensegment concise; split long sentences if they become unwieldy for listening practice.
3. Align Chinese to English segments
Split the full Chinese translation from Step 1 into segments that align with the English sentences from Step 2. Each zh entry should map cleanly to the corresponding en entry for listen-then-translate practice.
Alignment rules:
- One
ensentence maps to onezhsentence/segment. - If one English sentence requires multiple Chinese clauses, keep them within the same
zhentry. - Avoid mixing content from different English sentences into one
zhentry. - Prefer natural Chinese phrasing over word-for-word mapping, but keep information coverage aligned.
4. Validate output format
Ensure the JSON is an array of objects like:
[
{"en": "Example sentence.", "zh": "示例句子。"}
]
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-01-26
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!