Update references to toolkit paths and mpi- skill names

This commit is contained in:
iacore
2026-07-10 21:05:41 +08:00
parent ac9e6e3d1f
commit 79df1c6c4e
10 changed files with 35 additions and 35 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
"""Compare manuscript (DOCX English body) against typeset (PDF English body). """Compare manuscript (DOCX English body) against typeset (PDF English body).
Usage: python3 scripts/proofread-pdf.py <docx_path> <pdf_path> Usage: python3 toolkit/scripts/proofread-pdf.py <docx_path> <pdf_path>
Output: sentences from DOCX not found in PDF, and word-level changes within matched sentences. Output: sentences from DOCX not found in PDF, and word-level changes within matched sentences.
""" """
import re, sys, subprocess import re, sys, subprocess
+4 -4
View File
@@ -12,7 +12,7 @@ Translate `.pptx` files between Chinese and English. Covers the full pipeline: e
### 1. Extract strings to YAML ### 1. Extract strings to YAML
Run `scripts/extract.py original.pptx strings.yaml`. Produces YAML with entries: Run `toolkit/scripts/extract.py original.pptx strings.yaml`. Produces YAML with entries:
```yaml ```yaml
- slide: 1 - slide: 1
@@ -57,7 +57,7 @@ Scan for:
### 4. Write back with layout fixes ### 4. Write back with layout fixes
Run `scripts/build.py strings.yaml original.pptx translated.pptx`. Run `toolkit/scripts/build.py strings.yaml original.pptx translated.pptx`.
The script: The script:
- Replaces text in matching paragraphs (clears all runs, sets first run) - Replaces text in matching paragraphs (clears all runs, sets first run)
@@ -80,5 +80,5 @@ The absorbed `pptx-translation` skill had alternate script names: `extract_pptx.
## Scripts ## Scripts
- `scripts/extract.py` — extract strings from PPTX to YAML - `toolkit/scripts/extract.py` — extract strings from PPTX to YAML
- `scripts/build.py` — write translations back with font shrink + auto-fit - `toolkit/scripts/build.py` — write translations back with font shrink + auto-fit
+6 -6
View File
@@ -6,14 +6,14 @@ category: research
# Terms Search # Terms Search
Database: `$MPI_PROJECT_ROOT/terms-search/termlib.duckdb` Database: `$MPI_PROJECT_ROOT/toolkit/terms-database/termlib.duckdb`
CLI: `$MPI_PROJECT_ROOT/terms-search/search.py` CLI: `$MPI_PROJECT_ROOT/toolkit/terms-database/search.py`
Server: `$MPI_PROJECT_ROOT/terms-search/server.py` Server: `$MPI_PROJECT_ROOT/toolkit/terms-database/server.py`
## CLI (preferred) ## CLI (preferred)
``` ```
$MPI_PROJECT_ROOT/terms-search/search.py <query> [limit] $MPI_PROJECT_ROOT/toolkit/terms-database/search.py <query> [limit]
``` ```
Multi-word queries are ANDed. Searches both `zh` and `en` columns. Multi-word queries are ANDed. Searches both `zh` and `en` columns.
@@ -32,7 +32,7 @@ Use this inside `execute_code` scripts for batch lookups — no subprocess neede
## HTTP API (use only when CLI is insufficient) ## HTTP API (use only when CLI is insufficient)
Start: `python3 $MPI_PROJECT_ROOT/terms-search/server.py` (port 8910) Start: `python3 $MPI_PROJECT_ROOT/toolkit/terms-database/server.py` (port 8910)
- `GET /` — plain HTML UI (form + results table, no CSS) - `GET /` — plain HTML UI (form + results table, no CSS)
- `GET /` — plain HTML UI (form + results table, no CSS) - `GET /` — plain HTML UI (form + results table, no CSS)
@@ -64,7 +64,7 @@ Errors return `{"error": "..."}` with HTTP 500 (API) or shown inline (UI).
## Direct DuckDB ## Direct DuckDB
``` ```
duckdb $MPI_PROJECT_ROOT/terms-search/termlib.duckdb duckdb $MPI_PROJECT_ROOT/toolkit/terms-database/termlib.duckdb
``` ```
Key tables: `unified_terms_flat` (zh, en, loc, source), individual source tables, `unified_terms` view. Key tables: `unified_terms_flat` (zh, en, loc, source), individual source tables, `unified_terms` view.
@@ -112,7 +112,7 @@ duckdb path/to/termlib.duckdb
## Step 4: Create unified views ## Step 4: Create unified views
See `references/unified-view.sql` for the pattern. Key patterns: See `toolkit/references/unified-view.sql` for the pattern. Key patterns:
- `UNION ALL` across all source tables - `UNION ALL` across all source tables
- Normalize column names to `zh`, `en`, `loc` (出处), `source` - Normalize column names to `zh`, `en`, `loc` (出处), `source`
- For paired-column sheets (e.g., `中文/英文` + `补充内容/英文_1`), emit two UNION branches - For paired-column sheets (e.g., `中文/英文` + `补充内容/英文_1`), emit two UNION branches
@@ -10,7 +10,7 @@ After producing a first-pass translation, or when the user asks to check termino
1. Read the full translated file. Extract all Chinese terms from `{% "TERM" (pinyin) = ENGLISH ... %}` blocks. 1. Read the full translated file. Extract all Chinese terms from `{% "TERM" (pinyin) = ENGLISH ... %}` blocks.
2. Start the search server: `python3 $MPI_PROJECT_ROOT/terms-search/server.py &` (port 8910). It may already be running — check with `curl -s http://localhost:8910/`. 2. Start the search server: `python3 $MPI_PROJECT_ROOT/toolkit/terms-database/server.py &` (port 8910). It may already be running — check with `curl -s http://localhost:8910/`.
3. Batch-search each term via the HTTP API: 3. Batch-search each term via the HTTP API:
``` ```
+4 -4
View File
@@ -36,7 +36,7 @@ Switch to self-mode output in that case, but keep a collegial tone.
(Other mode only: read the translator's note if present, and address them by name.) (Other mode only: read the translator's note if present, and address them by name.)
2. Run a three-pass review using the detection rules below. 2. Run a three-pass review using the detection rules below.
3. Apply the R1R14 editorial polish checklist. 3. Apply the R1R14 editorial polish checklist.
4. Check terminology against the terms DB (see `terms-search` skill). 4. Check terminology against the terms DB (see `mpi-terms-search` skill).
5. Verify that every source paragraph maps to a target paragraph with no missing 5. Verify that every source paragraph maps to a target paragraph with no missing
or truncated content. or truncated content.
6. Produce the correct artifact for your mode. 6. Produce the correct artifact for your mode.
@@ -139,7 +139,7 @@ After the three passes, run these final checks.
- Record only non-obvious or project-level decisions in - Record only non-obvious or project-level decisions in
`translation-findings.dj`. `translation-findings.dj`.
- After editing, regenerate `bilingual.dj` with - After editing, regenerate `bilingual.dj` with
`../../scripts/gen-bilingual.py source.dj target.dj > bilingual.dj` and verify `../../toolkit/scripts/gen-bilingual.py source.dj target.dj > bilingual.dj` and verify
line counts match. line counts match.
### Other mode ### Other mode
@@ -207,7 +207,7 @@ Any DB queries or proposed term changes.
for this project's genres. for this project's genres.
- `references/buddhist-terminology.md` — register and convention notes for - `references/buddhist-terminology.md` — register and convention notes for
Buddhist/Dharma terms. Buddhist/Dharma terms.
- `../translation/SKILL.md` — the upstream translation skill that produces the - `../mpi-translation/SKILL.md` — the upstream translation skill that produces the
`target.dj` this skill reviews. `target.dj` this skill reviews.
- `../terms-search/SKILL.md` — skill for querying the terms database before and - `../mpi-terms-search/SKILL.md` — skill for querying the terms database before and
during review. during review.
@@ -17,7 +17,7 @@ correspondence, generate `bilingual.dj` directly from the DOCX:
4. Write bilingual.dj 4. Write bilingual.dj
The DOCX English is the authoritative target text. No PDF needed. The DOCX English is the authoritative target text. No PDF needed.
**Extraction approach**: start by adapting `scripts/gen-bilingual-docx.py`. **Extraction approach**: start by adapting `toolkit/scripts/gen-bilingual-docx.py`.
For articles where the body has strict CN→EN→CN→EN alternation, the simple 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. extraction in that script (CN line, blank, EN line, blank) works directly.
+8 -8
View File
@@ -45,7 +45,7 @@ Quick-find in index: Thầy talks → `"Thích Nhất Hạnh"` + page ≤ 10; te
### Pre-flight accuracy check ### Pre-flight accuracy check
Before delivering a translation, run through the structured accuracy/readability Before delivering a translation, run through the structured accuracy/readability
taxonomy in `../translation-review/references/common-issues-taxonomy.md`. taxonomy in `../mpi-translation-review/references/common-issues-taxonomy.md`.
Catching these before review saves iteration cycles: Catching these before review saves iteration cycles:
- Omission, over-literal renderings, over-free renderings, subject confusion, - Omission, over-literal renderings, over-free renderings, subject confusion,
overtranslation, terminology errors overtranslation, terminology errors
@@ -99,7 +99,7 @@ Read the English aloud — if a sentence can't be spoken in one breath, fix it.
These are common patterns (not an exhaustive list). For the full taxonomy with These are common patterns (not an exhaustive list). For the full taxonomy with
more categories and examples, read more categories and examples, read
`../translation-review/references/common-issues-taxonomy.md`. `../mpi-translation-review/references/common-issues-taxonomy.md`.
Examples of systematic adjustments: Examples of systematic adjustments:
@@ -119,9 +119,9 @@ Examples of systematic adjustments:
paper abstract, warm it up. Check against the MB corpus registers for the paper abstract, warm it up. Check against the MB corpus registers for the
target genre. target genre.
6. **Review-specific calques**. For *人生百问*-style Q&A, check the pattern 6. **Review-specific calques**. For *人生百问*-style Q&A, check the pattern
tables in `../translation-review/references/translation-pitfalls.md` for recurring tables in `../mpi-translation-review/references/translation-pitfalls.md` for recurring
stiff calques ("keen on," "more ultimate," "choice difficulty," etc.) and stiff calques ("keen on," "more ultimate," "choice difficulty," etc.) and
the Buddhist-term register notes in `../translation-review/references/buddhist-terminology.md`. the Buddhist-term register notes in `../mpi-translation-review/references/buddhist-terminology.md`.
Do NOT apply these mechanically — each is a judgment call. A passive may be Do NOT apply these mechanically — each is a judgment call. A passive may be
correct when the agent is unknown; a nominalization may be the right technical correct when the agent is unknown; a nominalization may be the right technical
@@ -204,7 +204,7 @@ The same words can imply different things in different cultural contexts.
Run this self-check before you hand off a first-pass translation. The goal is to Run this self-check before you hand off a first-pass translation. The goal is to
catch the most expensive errors while they are still cheap to fix. For the full catch the most expensive errors while they are still cheap to fix. For the full
post-translation review workflows, load `translation-review` (self mode for your own post-translation review workflows, load `mpi-translation-review` (self mode for your own
translations, other mode for peer review). translations, other mode for peer review).
### Accuracy ### Accuracy
@@ -215,7 +215,7 @@ translations, other mode for peer review).
- [ ] **No overtranslation**: no parenthetical expansions or explanations not in - [ ] **No overtranslation**: no parenthetical expansions or explanations not in
the source. the source.
- [ ] **Terminology**: key Buddhist terms checked against the MPI terms DB - [ ] **Terminology**: key Buddhist terms checked against the MPI terms DB
(`terms-search` skill). Consistent within the file. (`mpi-terms-search` skill). Consistent within the file.
- [ ] **Source faithfulness**: no concepts added, no details dropped. - [ ] **Source faithfulness**: no concepts added, no details dropped.
### Readability ### Readability
@@ -246,7 +246,7 @@ When translating guided meditation scripts, exercise guides, or posture instruct
### article-specific scripts ### article-specific scripts
`scripts/proofread-pdf.py` is hardcoded for 佛教徒的人生态度 — body-start `toolkit/scripts/proofread-pdf.py` is hardcoded for 佛教徒的人生态度 — body-start
markers, header patterns, slug regex. Do NOT reuse for other articles. markers, header patterns, slug regex. Do NOT reuse for other articles.
Create article-specific scripts per `references/proofread-pdf-workflow.md`. Create article-specific scripts per `references/proofread-pdf-workflow.md`.
@@ -257,5 +257,5 @@ Create article-specific scripts per `references/proofread-pdf-workflow.md`.
- `references/bilingual-format.md` — bilingual.dj layout: source/target adjacent, blank separator between pairs - `references/bilingual-format.md` — bilingual.dj layout: source/target adjacent, blank separator between pairs
- `references/diacritics-convention.md` — diacritics rules - `references/diacritics-convention.md` — diacritics rules
- `references/proofread-pdf-workflow.md` — pattern for creating article-specific PDF-vs-DOCX comparison scripts - `references/proofread-pdf-workflow.md` — pattern for creating article-specific PDF-vs-DOCX comparison scripts
- `../translation-review/references/common-issues-taxonomy.md` (cross-skill) — structured accuracy/readability checklist for pre-flight review - `../mpi-translation-review/references/common-issues-taxonomy.md` (cross-skill) — structured accuracy/readability checklist for pre-flight review
- Baker, Mona. *In Other Words: A Coursebook on Translation*. 2nd ed. Routledge, 2011. — levels of equivalence (word, above-word, grammatical, textual, pragmatic) and non-equivalence strategies. - Baker, Mona. *In Other Words: A Coursebook on Translation*. 2nd ed. Routledge, 2011. — levels of equivalence (word, above-word, grammatical, textual, pragmatic) and non-equivalence strategies.
@@ -6,7 +6,7 @@ drift, repositioned phrases, extra content.
## Pattern ## Pattern
The existing `scripts/proofread-pdf.py` is article-specific (hardcoded to The existing `toolkit/scripts/proofread-pdf.py` is article-specific (hardcoded to
佛教徒的人生态度). For each new article, create a similarly-shaped script: 佛教徒的人生态度). For each new article, create a similarly-shaped script:
``` ```
@@ -38,7 +38,7 @@ Hash = `md5('translate-files/<article>')[:6]`
chunk-based matching instead of word-by-word comparison. chunk-based matching instead of word-by-word comparison.
- Section headers (I, II, III) may be present in DOCX body but filtered - Section headers (I, II, III) may be present in DOCX body but filtered
from PDF — not real discrepancies. from PDF — not real discrepancies.
- The existing `scripts/proofread-pdf.py` is hardcoded for 佛教徒的人生态度. - The existing `toolkit/scripts/proofread-pdf.py` is hardcoded for 佛教徒的人生态度.
Do NOT reuse it for other articles without rewriting the body-start Do NOT reuse it for other articles without rewriting the body-start
markers and filter patterns. Create article-specific scripts instead. markers and filter patterns. Create article-specific scripts instead.
- `git diff --word-diff` fails when one file is multi-line and the other - `git diff --word-diff` fails when one file is multi-line and the other
+7 -7
View File
@@ -9,7 +9,7 @@ Add to `~/.hermes/config.yaml`:
```yaml ```yaml
skills: skills:
external_dirs: external_dirs:
- $MPI_PROJECT_ROOT/skills - $MPI_PROJECT_ROOT/toolkit/skills
``` ```
{% Edit config.yaml directly — `hermes config set` stores list values as strings. %} {% Edit config.yaml directly — `hermes config set` stores list values as strings. %}
@@ -18,9 +18,9 @@ skills:
| Name | What it does | | Name | What it does |
|---|---| |---|---|
| `translation` | Translate Chinese↔English Buddhist/Dharma content | | `mpi-translation` | Translate Chinese↔English Buddhist/Dharma content |
| `terms-search` | Full-text search across MPI term database | | `mpi-terms-search` | Full-text search across MPI term database |
| `translation-review` | Review translations for quality issues | | `mpi-translation-review` | Review translations for quality issues |
| `chinese-text-normalize` | Normalize Chinese markdown line breaks | | `mpi-chinese-text-normalize` | Normalize Chinese markdown line breaks |
| `pptx-translate` | Translate PowerPoint files | | `mpi-pptx-translate` | Translate PowerPoint files |
| `pdf-to-docx-conversion` | Convert PDFs to DOCX with layout preservation | | `mpi-pdf-to-docx-conversion` | Convert PDFs to DOCX with layout preservation |