translate: 生命也可以被设计的 — bilingual.dj + edit-suggestions
This commit is contained in:
@@ -74,10 +74,7 @@ Remove entries for sibling articles — the combined TOC is a print-document art
|
||||
|
||||
Structure: interleave Chinese source and English target paragraph-by-paragraph.
|
||||
|
||||
**Preferred workflow**: when the DOCX manuscript has both languages in 1:1
|
||||
correspondence (Chinese, blank, English, blank), extract directly from DOCX.
|
||||
No PDF needed — the DOCX English IS the target. See
|
||||
`references/proofreading-patterns.md` for the extraction script logic.
|
||||
**Preferred workflow**: when the DOCX manuscript has both languages in 1:1\ncorrespondence, extract directly from DOCX. No PDF needed — the DOCX English IS\nthe target. Adapt `scripts/gen-bilingual-docx.py` as a starting point.\n\nPitfall: DOCX manuscripts sometimes order CN content before EN content within a\nsection (CN heading → CN body → EN heading → EN body) rather than strict\nCN→EN→CN→EN alternation. The simple extraction in `gen-bilingual-docx.py` fails\nfor these. Use block-based extraction instead — see\n`references/proofreading-patterns.md` for the approach.
|
||||
|
||||
**Title & subtitle**: adjacent pair (source, target, no blank between), then a single blank line before the next pair.
|
||||
|
||||
@@ -129,6 +126,8 @@ This keeps the agent's output concise — the user sees the results, not the cod
|
||||
- `dj2docx.fish` — convert `target.dj` → `/tmp/<dirname>-英文.docx` via pandoc.
|
||||
Usage: `fish scripts/dj2docx.fish <path-to-target.dj>`
|
||||
- `proofread-pdf.py <docx> <pdf>` — compare manuscript DOCX against typeset PDF.
|
||||
- `gen-bilingual-docx.py` — generate `bilingual.dj` directly from DOCX manuscript
|
||||
(English target comes from DOCX, not PDF). Article-specific; name with hash.
|
||||
- `gen-bilingual-docx.py` — template for generating `bilingual.dj` directly from DOCX manuscript.
|
||||
Adapt for each article by changing paths and article-specific metadata.
|
||||
For articles with mixed CN→EN ordering, use block-based extraction instead
|
||||
of simple alternation (see `references/proofreading-patterns.md`).
|
||||
- `gen-bilingual.fish <article-dir>` — generate `bilingual.dj` from `source.dj` + `target.dj`.
|
||||
|
||||
@@ -8,10 +8,34 @@ When the DOCX manuscript has both Chinese and English in 1:1 paragraph
|
||||
correspondence, generate `bilingual.dj` directly from the DOCX:
|
||||
|
||||
1. `pandoc docx → plain text`
|
||||
2. Extract Chinese-English pairs from body (Chinese line, blank, English line, blank)
|
||||
2. Extract Chinese-English pairs from body
|
||||
3. Apply fixes: italicize Sanskrit on first occurrence, fix `N.Letter` → `N. Letter` spacing
|
||||
4. Write bilingual.dj
|
||||
The DOCX English is the authoritative target text. No PDF needed.
|
||||
|
||||
**Extraction approach**: start by adapting `scripts/gen-bilingual-docx.py`.
|
||||
For articles where the body has strict CN→EN→CN→EN alternation, the simple
|
||||
extraction in that script (CN line, blank, EN line, blank) works directly.
|
||||
|
||||
**Block-based extraction** (for articles with mixed ordering): when the DOCX has
|
||||
sections that order CN content before EN content (CN heading → CN body → EN heading →
|
||||
EN body), the simple alternation fails. Use block-based extraction instead:
|
||||
|
||||
1. Tag each non-blank line as CN or EN (via `has_cjk()`)
|
||||
2. Join page-break split paragraphs: merge consecutive same-language paragraphs
|
||||
only when the first is long (>30 chars), doesn't end with CJK/ASCII terminal
|
||||
punctuation (`[。!?:).?!]$`), and isn't heading-like (starts with
|
||||
`^[\dIVX]+[\.\s]` and <60 chars)
|
||||
3. Group consecutive same-language items into blocks
|
||||
4. Walk blocks: for each CN block, pair with the next EN block via `zip()`.
|
||||
`min(len(cn), len(en))` handles translator-introduced paragraph splits.
|
||||
|
||||
**Page-break splits in pandoc plain-text output**: the DOCX→plain conversion
|
||||
sometimes splits a Chinese paragraph mid-sentence (e.g. `白居` + `易、苏轼…`).
|
||||
These appear as two consecutive CN lines separated by a blank. The join heuristic
|
||||
above catches these reliably. For EN text, page-break splits are rare; the heading
|
||||
detection (`^[\dIVX]+[\.\s]`, <60 chars) prevents false merges of EN headings
|
||||
with following EN body paragraphs.
|
||||
The DOCX English is the authoritative target text. No PDF needed.
|
||||
|
||||
### B. Bilingual from PDF (when PDF is the typeset target)
|
||||
@@ -54,6 +78,13 @@ under the chapter headings where the issues occur. Use diff-style `-/+` notation
|
||||
- Merged duplicate edits: cut-paste errors where old+new text appear together
|
||||
- `N.Letter` without space: `2.How` → `2. How`
|
||||
- `the The` double article
|
||||
- **Numbering mismatches**: CN and EN headings sometimes disagree (e.g. CN `3.` vs EN `2.`).
|
||||
The TOC usually has the correct number — flag the body heading for correction.
|
||||
- **Doubled names**: `岳麓书院岳麓书院` — cut-paste artifacts in Chinese body text.
|
||||
- **EN paragraph splits without CN counterpart**: translator sometimes renders one CN
|
||||
paragraph as two EN paragraphs. The block-based extractor drops the extra EN paragraph
|
||||
(as `min(len_cn, len_en)`). Flag in edit-suggestions so it can be manually merged or
|
||||
the CN paragraph can be split.
|
||||
|
||||
## Sanskrit italicization
|
||||
|
||||
|
||||
Reference in New Issue
Block a user