translate, done with 众生都是既然众生 and 佛教徒的人生态度
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
---
|
||||
name: mpi-project-conventions
|
||||
description: Use when working in the MPI project (~/documents/mpi) — translation skill management, terms database, djot conventions, and skill relocation workflow.
|
||||
---
|
||||
|
||||
# MPI Project Conventions
|
||||
|
||||
Project directory: `/home/user/documents/mpi/`
|
||||
|
||||
## Skill management
|
||||
|
||||
Translation-related skills live in `./skills/` (canonical source). Hermes discovers
|
||||
them via `skills.external_dirs` in `~/.hermes/config.yaml`:
|
||||
|
||||
```yaml
|
||||
skills:
|
||||
external_dirs:
|
||||
- /home/user/documents/mpi/skills
|
||||
```
|
||||
|
||||
Set with: `hermes config set skills.external_dirs '[/home/user/documents/mpi/skills]'`
|
||||
|
||||
Pitfall: `hermes config set` stringifies list values. After running it, verify the
|
||||
YAML has proper list syntax (`- /path`, not `'[/path]'`). Edit manually if needed.
|
||||
|
||||
The old symlink approach (`~/.hermes/skills/dharma-translation` → `./skills/`) is
|
||||
deprecated. `skills/install.fish` has been replaced by `skills/readme.dj`.
|
||||
|
||||
## Terms database
|
||||
|
||||
- **Module (preferred)**: `from search import search` — call directly in `execute_code` scripts.
|
||||
`search("空性", limit=5, loc="...", src="DoT定稿")` → list of `{zh, en, loc, source}` dicts.
|
||||
No subprocess, no text parsing. Import after `sys.path.insert(0, '/home/user/documents/mpi/terms-search')`.
|
||||
- CLI: `/home/user/documents/mpi/terms-search/search.py <query> [limit]`
|
||||
- Server: `terms-search/server.py` (Flask, port 8910) — use only when module/CLI is insufficient
|
||||
- Start: `python3 /home/user/documents/mpi/terms-search/server.py &`
|
||||
- Query: `http://localhost:8910/search?q=...`
|
||||
|
||||
## Djot conventions
|
||||
|
||||
- Comments use `{% ... %}` syntax
|
||||
- Emphasis: `*text*` (single asterisks). `**text**` is Markdown, NOT Djot — never use it.
|
||||
- Em dashes: `---` (three hyphens in English text). Pandoc converts to proper em dash in docx output.
|
||||
- En dashes: `--` (two hyphens). Pandoc converts to proper en dash in docx output.
|
||||
- Preserve source formatting level exactly: if the source has no emphasis on a label, the translation must have none. Do not add or remove formatting.
|
||||
- TOC in both `source.dj` and `target.dj`: use clean bullet lists (`- *Section*` / ` - N.item`), not `[text](#anchor)` link markup. Those links are pandoc markdown artifacts. Both files should use the same TOC format.
|
||||
- Bilingual files: create `bilingual.dj` alongside `source.dj` and `target.dj`. No new 对照.dj files — existing ones in old projects are artifacts, don't delete them. Generate with `fish scripts/gen-bilingual.fish <article-dir>`. Format: see Bilingual file format section below.
|
||||
|
||||
### Markdown → Djot conversion (pandoc)
|
||||
|
||||
```bash
|
||||
pandoc input.md -f markdown -t djot --wrap=none -o output.dj
|
||||
```
|
||||
|
||||
Pitfall: pandoc strips `{#id}` attributes from headings but leaves behind stray
|
||||
`{#...}` lines. Pre-strip heading anchors from the markdown before conversion:
|
||||
|
||||
```bash
|
||||
sed 's/ {#[^}]*}//g' input.md | pandoc -f markdown -t djot --wrap=none -o output.dj
|
||||
```
|
||||
|
||||
Follow up by removing any remaining standalone `{#...}` lines from the djot output:
|
||||
|
||||
```bash
|
||||
sed -i '/^{#.*}$/d' output.dj
|
||||
```
|
||||
|
||||
Pitfall — combined documents: When the source `.docx.md` contains multiple articles,
|
||||
the TOC at the top often covers all articles. After splitting into per-article
|
||||
`source.dj` files, verify each TOC only lists headings that belong to that article.
|
||||
Remove entries for sibling articles — the combined TOC is a print-document artifact.
|
||||
|
||||
### Bilingual file format (bilingual.dj)
|
||||
|
||||
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.
|
||||
|
||||
**Title & subtitle**: adjacent pair (source, target, no blank between), then a single blank line before the next pair.
|
||||
|
||||
**TOC**: source TOC block, blank line, target TOC block — NOT interleaved line-by-line.
|
||||
|
||||
**Body**: source line, target line (adjacent — NO blank between them), then a single blank line between pairs.
|
||||
|
||||
Pitfall: do NOT put a blank between source and target within a body pair.
|
||||
|
||||
**Edit suggestions**: after generating bilingual.dj, scan for issues (garbled text,
|
||||
numbering mismatches, translator notes, repeated words) and write
|
||||
`edit-suggestions.dj`. Follow the original document's section layout — group
|
||||
suggestions under chapter headings, not by issue type. Use diff `-/+` notation.
|
||||
|
||||
## Translation skills
|
||||
|
||||
Skills tracked in this project:
|
||||
- `terms-search` — full-text search across the MPI term database
|
||||
- `translation-review` — review CN↔EN translations (CSV/XLSX + .dj comparison)
|
||||
- `pptx-translate` — translate PowerPoint files
|
||||
- `dharma-translation` — translate Buddhist Dharma talks
|
||||
- `chinese-text-normalize` — normalize Chinese markdown line breaks
|
||||
- `pdf-to-docx-conversion` — convert PDFs to DOCX with layout preservation
|
||||
|
||||
See `references/meditation-translation.md` for lighter workflow when translating
|
||||
guided meditation / mindfulness exercise content (vs. Dharma talks).
|
||||
|
||||
See `references/translation-pitfalls.md` for recurring CN→EN mistranslation patterns
|
||||
(关爱→compassion, 生生增上, 因病返贫, 生存层面, etc.) — review this before starting
|
||||
any translation review.
|
||||
|
||||
See `references/markdown-to-djot.md` for converting `.docx.md` source files to djot,\nincluding splitting combined articles and cleaning pandoc heading anchors.\n\nSee `references/proofreading-patterns.md` for common manuscript-vs-typeset\ndifferences (term substitutions, numbering changes, typesetting artifacts in\npdftotext output) and the bilingual-from-PDF workflow.
|
||||
|
||||
## Utility scripts
|
||||
|
||||
Project scripts live in `~/documents/mpi/scripts/`. Write them in fish shell for
|
||||
CLI wrappers, Python for data processing.
|
||||
|
||||
**Naming**: generic reusable scripts get descriptive names (`dj2docx.fish`,
|
||||
`proofread-pdf.py`). Article-specific one-off scripts use `<name>-<hash>.<ext>`
|
||||
to signal they're not general-purpose. Don't name a single-article script as if
|
||||
it were reusable.
|
||||
|
||||
**Agent workflow**: when doing repetitive Python processing (text extraction,
|
||||
diffing, data transforms), write the logic to a script in `scripts/` and run it
|
||||
via `terminal`. Don't regenerate the same Python in `execute_code` across turns.
|
||||
This keeps the agent's output concise — the user sees the results, not the code.
|
||||
|
||||
- `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.fish <article-dir>` — generate `bilingual.dj` from `source.dj` + `target.dj`.
|
||||
@@ -0,0 +1,48 @@
|
||||
# Markdown to Djot Conversion
|
||||
|
||||
When source material arrives as `.docx.md` (pandoc-converted from docx), convert to `.dj` for translation workflows.
|
||||
|
||||
## Splitting combined articles
|
||||
|
||||
If a single markdown file contains multiple articles (common when docx has two talks in one file), split at the article boundary before converting. Use `sed` by line number:
|
||||
|
||||
```bash
|
||||
sed -n '1,218p' combined.md > a1.md
|
||||
sed -n '220,282p' combined.md > a2.md
|
||||
```
|
||||
|
||||
## Heading anchor cleanup
|
||||
|
||||
Pandoc's docx→md conversion adds `{#heading-id}` anchors to every heading:
|
||||
|
||||
```markdown
|
||||
## 1.安宁疗护 {#1.安宁疗护}
|
||||
```
|
||||
|
||||
These must be stripped before markdown→djot conversion, otherwise pandoc's djot writer leaves stray `{#...}` lines in the output:
|
||||
|
||||
```bash
|
||||
sed 's/ {#[^}]*}//g' input.md > clean.md
|
||||
```
|
||||
|
||||
## Conversion command
|
||||
|
||||
```bash
|
||||
pandoc clean.md -f markdown -t djot --wrap=none -o output.dj
|
||||
```
|
||||
|
||||
`--wrap=none` prevents reflow of long paragraphs.
|
||||
|
||||
## Post-conversion cleanup
|
||||
|
||||
Pandoc may still leave stray `{#...}` lines in djot output. Remove them:
|
||||
|
||||
```bash
|
||||
sed -i '/^{#.*}$/d' output.dj
|
||||
```
|
||||
|
||||
## Pandoc artifacts
|
||||
|
||||
- Unicode `——` (U+2014 × 2) → `------` in djot (two em dashes, `---` each). This is correct djot syntax.
|
||||
- Markdown hard line breaks (trailing ` `) → `\\\n` in djot. Preserves original paragraph structure.
|
||||
- Pandoc normalizes heading IDs (strips `、` and other punctuation). Ignore; the stray-line cleanup handles it.
|
||||
@@ -0,0 +1,43 @@
|
||||
# Meditation / Mindfulness Content Translation
|
||||
|
||||
When the source is a guided meditation script, exercise guide, posture instruction,
|
||||
or breathing practice (rather than a Dharma talk, sutra commentary, or teaching text),
|
||||
use a lighter workflow than the full dharma-translation pipeline.
|
||||
|
||||
## Register
|
||||
|
||||
Default to warm, direct instructional voice (Thầy-adjacent):
|
||||
- Second-person address ("you")
|
||||
- Concrete images, sensory details
|
||||
- Oral rhythm, short sentences
|
||||
- Present tense, imperative mood
|
||||
|
||||
MB corpus consultation is NOT needed for register — this content type has its own
|
||||
well-established English conventions (yoga/meditation instructional voice).
|
||||
|
||||
## Terms
|
||||
|
||||
Terms DB lookup for Buddhist-mindfulness vocabulary is useful but limited to key terms:
|
||||
- 正念 → mindfulness
|
||||
- 觉知 → awareness
|
||||
- 无我 → depends on context: "non-self" for philosophical/Dharma content; "selflessly" for embodied/movement instruction where the sense is no separate controller imposing on the action
|
||||
- 中道 → Middle Way
|
||||
- 丹田 → dantian (keep as-is; well-known in meditation/qigong)
|
||||
|
||||
Context-sensitive terms:
|
||||
- 心 (xīn): in meditation/movement contexts it often means "mind/attention" not emotional "heart." 持心 means holding the mind with focused attention, not holding with emotion.
|
||||
- 念 (niàn): mindfulness/attention/recollection — context between these.
|
||||
- Buddhist philosophical terms (无我, 空, 缘起) in non-philosophical contexts (movement instruction, body scans) may need practical/concrete translations rather than doctrinal ones.
|
||||
|
||||
Skip deep terms alignment unless dense Dharma vocabulary (emptiness, dependent origination,
|
||||
Buddha-nature, etc.) appears in the text.
|
||||
|
||||
## Comparison files
|
||||
|
||||
Still create 对照.dj as usual. See comparison file format in this skill.
|
||||
|
||||
## Pitfalls
|
||||
|
||||
- **Don't add formatting the source doesn't have**: sub-section labels using `【】` in Chinese should become plain `[label]` in English, not `*[label]*` or `**[label]**`. Match the source's formatting level exactly.
|
||||
- **`**text**` is Markdown, not Djot**: Djot emphasis uses single asterisks (`*text*`). Never use double asterisks in `.dj` files.
|
||||
- **心 ≠ heart by default**: in meditation/movement contexts, 持心 = holding the mind with attention, not holding with emotion. Translate based on context, not dictionary defaults.
|
||||
@@ -0,0 +1,63 @@
|
||||
# Proofreading: Manuscript vs Typeset
|
||||
|
||||
## Two workflows
|
||||
|
||||
### A. Bilingual from DOCX (standard)
|
||||
|
||||
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)
|
||||
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.
|
||||
|
||||
### B. Bilingual from PDF (when PDF is the typeset target)
|
||||
|
||||
When the PDF English is the typeset "final" version and should be the target:
|
||||
|
||||
1. Extract DOCX Chinese paragraphs (source)
|
||||
2. Extract PDF body text via `pdftotext -layout`
|
||||
3. Clean PDF: remove slug lines, headers, page numbers, join hyphenation breaks
|
||||
4. Match DOCX English paragraphs against PDF body to find positions
|
||||
5. Segment PDF body at matched positions
|
||||
6. Write bilingual.dj with Chinese source + PDF English target
|
||||
|
||||
**Pitfalls in PDF extraction:**
|
||||
- Consecutive hyphenation breaks (e.g. `thou-` + `sand...al-` + `leviate`) — the join
|
||||
loop must be recursive: after joining pair N, check if result still ends with `-`
|
||||
and join with line N+2
|
||||
- Lines with leading whitespace: use `lstrip()` before checking `n[0].islower()`
|
||||
- Drop-cap artifacts: `L iving` → `Living`
|
||||
- Trailing section numbers: `...viewpoints. 1)` — the ` 1)` is a PDF section marker
|
||||
bleeding into the previous paragraph
|
||||
|
||||
### C. Edit suggestions (edit-suggestions.dj)
|
||||
|
||||
After generating bilingual.dj, scan for issues and write `edit-suggestions.dj`:
|
||||
|
||||
**Format**: follow the original document's section/chapter layout. Group suggestions
|
||||
under the chapter headings where the issues occur. Use diff-style `-/+` notation.
|
||||
|
||||
**What to flag:**
|
||||
- Garbled Chinese text (merged duplicate edits in source DOCX)
|
||||
- Repeated words (`the The`)
|
||||
- Chapter numbering mismatches (e.g. `九` ↔ `VIII`)
|
||||
- Translator notes in headings (`(善鑫翻,妙一审)`)
|
||||
- Missing quotes around dialogue/speech
|
||||
|
||||
## Common source DOCX issues
|
||||
|
||||
- Translator notes in Chinese headings: `(某某翻,某某审)` — delete for publication
|
||||
- Merged duplicate edits: cut-paste errors where old+new text appear together
|
||||
- `N.Letter` without space: `2.How` → `2. How`
|
||||
- `the The` double article
|
||||
|
||||
## Sanskrit italicization
|
||||
|
||||
On first occurrence in body text, wrap with `*term*`. Track seen terms across
|
||||
the full body. Terms: bodhisattva, bodhicitta, samsara, Dharma, karma, nirvana,
|
||||
Sangha, sutra, Mahayana, Sravaka, Vinaya, Lamrim, Ksitigarbha, Samantabhadra,
|
||||
Chan, Arhatship, Theravada.
|
||||
@@ -0,0 +1,77 @@
|
||||
# Translation Pitfalls — MPI Buddhist Texts
|
||||
|
||||
Patterns found in CN→EN translation review. Add to this file as new patterns emerge.
|
||||
|
||||
## Terminology conflation
|
||||
|
||||
### 关爱/关怀 → compassion (WRONG)
|
||||
|
||||
Chinese 关爱 and 关怀 mean "care" or "loving care." They are NOT 慈悲 (compassion / karuṇā).
|
||||
Conflating them obscures two distinct Buddhist concepts.
|
||||
|
||||
Check every occurrence of "compassion" in a translation against the source:
|
||||
- If source is 关爱/关怀 → "care"
|
||||
- If source is 慈悲 → "compassion" (correct)
|
||||
- If source is 悬壶济世 → "compassionate mission" (correct — the healing spirit)
|
||||
|
||||
### 生存层面 → making a living (WRONG)
|
||||
|
||||
生存层面 = the existential/survival dimension. Not just earning wages.
|
||||
→ "survival-level needs" or "the level of basic existence"
|
||||
|
||||
## Loss of Dharma meaning
|
||||
|
||||
### 生生增上 → continuously elevate our life (INCOMPLETE)
|
||||
|
||||
生生 = life after life (multi-life Buddhist perspective). The single-life rendering
|
||||
"continuously elevate our life" loses the Dharma meaning entirely.
|
||||
→ "continuously elevate our life, life after life"
|
||||
|
||||
## False implication
|
||||
|
||||
#### 因病返贫 → "back into poverty"
|
||||
"返贫" means becoming poor due to illness, not returning to previous poverty. Use "into poverty" or "driven into poverty."
|
||||
|
||||
#### Diacritics: use DB form, not academic Sanskrit
|
||||
| Wrong | Right | Source |
|
||||
|---|---|---|
|
||||
| `Mahāsthāmaprāpta` | `Mahasthamaprapta` | 佛教术语 |
|
||||
| `Yogācārabhūmi Śāstra` | `Yogacarabhumi-Sastra` | 经论名 |
|
||||
| `Avalokiteśvara` | `Guanyin` | 佛教术语 |
|
||||
| `pravāraṇā` | `Pavarana` | BAICKZ |
|
||||
|
||||
Exception: `Kṣitigarbha` — DoT定稿 uses diacritics, so keep them.
|
||||
When in doubt, search the DB and follow the highest-priority source. See dharma-translation skill `references/diacritics-convention.md`.
|
||||
|
||||
返贫 = become poor (from a non-poor state) due to medical costs. "Back" implies
|
||||
the person was previously poor — not necessarily true. This is about medical bankruptcy.
|
||||
→ "into poverty" or "fall into poverty" (no "back")
|
||||
|
||||
## DoT定稿 term drift
|
||||
|
||||
### 念死 → recollection of death (WRONG per DoT定稿)
|
||||
|
||||
DoT定稿 has "Cultivating mindfulness of death" / 佛教术语 has "contemplating the
|
||||
impermanence of death". The established term is "mindfulness of death", not
|
||||
"recollection of death." → "mindfulness of death" / "death-mindfulness"
|
||||
|
||||
### 三级修学 → Three-Level Study Program (WRONG per DoT定稿)
|
||||
|
||||
DoT定稿 has "Three-Stage Practice." → "Three-Stage Practice"
|
||||
|
||||
### 下士道/中士道/上士道
|
||||
|
||||
DoT定稿: "Path for Persons of Small/Medium/Great Capacity" — not "path of the
|
||||
initial/middle/great scope."
|
||||
|
||||
### 观音菩萨 → Avalokiteśvara (AVOID in MPI translations)
|
||||
|
||||
佛教术语 has "Guanshiyin/Guanyin Bodhisattva." Use "Guanyin Bodhisattva."
|
||||
|
||||
## Workflow pitfall
|
||||
|
||||
### Translating before consulting terms DB
|
||||
|
||||
Always search key terms BEFORE translating. The dharma-translation skill says to do
|
||||
this, but it's easy to skip. Use the CLI: `/home/user/documents/mpi/terms-search/search.py <query>`.
|
||||
Prioritize DoT定稿 > 内部特色词 > 佛教术语 > 经论名.
|
||||
Reference in New Issue
Block a user