Community연구 & 데이터 분석github.com

scientific-literature-translator

Translate scientific PDFs, Markdown, and text manuscripts into terminology-locked, paragraph-aligned bilingual outputs with evidence locators and automated fidelity auditing. Use for literature translation, glossary-enforced EN<->ZH academic translation, long multi-column paper chunked translation, and translation quality verification (numbers, units, citations, formulas, negations). Does not fabricate missing text on unreadable scans.

scientific-literature-translator란 무엇인가요?

scientific-literature-translator is a Claude Code agent skill that translate scientific PDFs, Markdown, and text manuscripts into terminology-locked, paragraph-aligned bilingual outputs with evidence locators and automated fidelity auditing. Use for literature translation, glossary-enforced EN<->ZH academic translation, long multi-column paper chunked translation, and translation quality verification (numbers, units, citations, formulas, negations). Does not fabricate missing text on unreadable scans.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Quanta-Byte/scientific-literature-translator/tree/HEAD

Installed? Explore more 연구 & 데이터 분석 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Scientific Literature Translator (Terminology-Locked & Evidence-Verified)

Translate scientific documents while keeping terminology locked, paragraph alignment complete, logical/numeric/citation relations accurate, and every segment traceable back to source pages and block IDs. Never guess text on unreadable scans, never fabricate missing numbers or citations, and never alter original equations or reference labels.

Inputs, Work, and Outputs

  • Default evaluation inputs: /input/case.json, /input/task.md, and the declared source file (.pdf, .md, .txt, .tex, or inline text in case.json), plus any supplied glossary (.json/.tsv/.csv).
  • Work directory: /app/work (case_context.json, structured.json, segments.json, glossary.json, chunks/, translations.json, translation_audit.json).
  • Final outputs: /app/output/result.json, /app/output/bilingual_document.md, /app/output/glossary.md, /app/output/glossary.json, /app/output/translation_audit.md, and /app/output/previews/ (for formula/algorithm PNGs).
  • Skill path: caller sets SKILL_DIR explicitly (e.g., /skills/weekly-skill); scripts never assume current working directory.

Step 0: Resolve Case, Scope, Glossary Overrides, and Runtime

SKILL_DIR=/skills/weekly-skill
INPUT_DIR=/input
WORK_DIR=/app/work
OUTPUT_DIR=/app/output
python3 "$SKILL_DIR/scripts/prepare_case.py" \
  --input "$INPUT_DIR" --work "$WORK_DIR" --output "$OUTPUT_DIR"

Read task and output_contract in $WORK_DIR/case_context.json. If input paths in case.json use container prefixes during local testing, pass --path-map OLD=NEW or --source <actual_file>. Check translation_spec (source_lang, target_lang, translate_references). If task.md restricts translation to specific pages or sections, pass --pages or --sections in Step 1.

Step 1: Extract Layout-Aware Logical Segments

python3 "$SKILL_DIR/scripts/extract_segments.py" \
  --context "$WORK_DIR/case_context.json" --work "$WORK_DIR" --engine auto

What this guarantees:

  • PDFs: invokes parse_pdf.py + layout.py (PyMuPDF primary, Poppler pdftotext fallback, optional 300 DPI tesseract OCR on image-only pages) for multi-column reading order, header/footer/watermark isolation, table Markdown extraction, formula PNG previews, and (page, bbox, block_id) locators.
  • Line & Cross-Boundary Reconstruction: removes soft line-wrap hyphens (infor-\nmation -> information) while preserving true hyphenated compounds (end-to-end), merges sentences split across column or page boundaries (cross_boundary_merged: true), and records all constituent evidence_ids and source_pages.
  • Markdown/TXT: parses headings, paragraphs, and synthetic doc-p1-b* evidence locators uniformly.
  • Optional flags: --pages 1-4, --sections "abstract|introduction|conclusion", --translate-references.

Step 2: Build & Lock Terminology Glossary Before Translating

python3 "$SKILL_DIR/scripts/build_glossary.py" \
  --segments "$WORK_DIR/segments.json" --work "$WORK_DIR"

Inspect $WORK_DIR/glossary.tsv / $WORK_DIR/glossary.json:

  1. Acronym definitions (Full Term (ACR)), bilingual pairs, high-frequency domain noun phrases, and technical acronyms/metrics are extracted and ranked automatically, merged with any case-provided glossary.
  2. Lock target translations BEFORE translating body paragraphs: review top domain terms and acronyms, decide exact target terms (and optional allowed_variants), write a compact locks JSON/TSV ([{"source_term": "...", "locked_target": "..."}]), and apply it:
python3 "$SKILL_DIR/scripts/build_glossary.py" \
  --segments "$WORK_DIR/segments.json" --work "$WORK_DIR" \
  --apply-locks "$WORK_DIR/glossary_locks.json"

Do not skip locking: verify_translation.py checks every locked term across Title, Abstract, Body, Captions, Tables, and Conclusions.

Step 3: Create Budget-Safe Context-Carrying Chunks

python3 "$SKILL_DIR/scripts/chunk_for_translation.py" \
  --segments "$WORK_DIR/segments.json" \
  --glossary "$WORK_DIR/glossary.json" \
  --work "$WORK_DIR" --max-chars 3600 --max-segments 14

This creates $WORK_DIR/chunks/chunk_001.json, ... within the 64-request Harbor budget. Each chunk supplies:

  • carryover_previous_segments: trailing context from the previous chunk for pronoun & discourse continuity across page/column breaks.
  • active_glossary: exact subset of locked terms appearing in that chunk.
  • items[]: each para_id with source_text, protected_tokens (citations, cross_refs, urls_dois, numbers_units), and empty translated_text / translation_basis slots.

Step 4: Translate Chunk-by-Chunk With Evidence & Honesty Rules

For each chunk_NNN.json, populate every item's:

  • translated_text: faithful, complete academic translation (never summarize or skip clauses).
    • Terminology: strictly use each active_terms[].locked_target.
    • Relations: preserve negation (not, never, without, unless), scope/quantifiers (only if, at most, at least), causal/concessive links (because, although, whereas), and pronoun referents.
    • Protected tokens: preserve exact numbers, signs, percentages vs percentage points, units, [N] / (Author, Year) citations, Fig./Table/Eq./Alg. numbers, and URLs/DOIs.
    • Tables: translate caption and text headers/labels while keeping numeric cells and Markdown pipes intact.
    • Formulas (preserve_and_note) & References (keep_verbatim): pre-populated in chunks_manifest.json; keep formula tokens verbatim and cite preview images for visual verification.
  • translation_basis: concise basis noting key glossary locks or syntactic/discourse choices (e.g., Locked terms: SDN->立体深度网络; preserved conditional 'unless' and [3]).
  • uncertainty_note: if source text has OCR noise, clipped text, control glyphs, or ambiguous symbol layout, keep needs_review: true and state what needs human check.

After finishing all chunks, merge deterministically:

python3 "$SKILL_DIR/scripts/chunk_for_translation.py" \
  --segments "$WORK_DIR/segments.json" --work "$WORK_DIR" --merge

Step 5: Programmatic Quality Audit & Repair Loop

python3 "$SKILL_DIR/scripts/verify_translation.py" \
  --segments "$WORK_DIR/segments.json" \
  --glossary "$WORK_DIR/glossary.json" \
  --translations "$WORK_DIR/translations.json" \
  --work "$WORK_DIR"

Inspect $WORK_DIR/translation_audit.md and $WORK_DIR/translation_audit.json. Automated checks verify:

  1. Segment completeness (completion_rate, zero missing/empty/duplicate para_id).
  2. Terminology consistency (terminology_consistency_rate globally and by section: title, abstract, body, caption, table, conclusion).
  3. Numeric/unit/percentage fidelity.
  4. Citation [N] and Fig./Table/Eq. cross-reference preservation.
  5. Negation/conditional cue alignment (negation_condition_review).
  6. Untranslated copy-paste leaks or placeholder tokens (TODO, [[...]]).

Fix any real terminology mismatches, missing numbers/citations, or negation errors in the affected chunks, re-merge, and re-run verify_translation.py --strict before Step 6. Never delete warnings merely to make status look clean.

Step 6: Assemble Deliverables & Validate Contract

python3 "$SKILL_DIR/scripts/make_result.py" \
  --structured "$WORK_DIR/structured.json" \
  --segments "$WORK_DIR/segments.json" \
  --glossary "$WORK_DIR/glossary.json" \
  --translations "$WORK_DIR/translations.json" \
  --audit "$WORK_DIR/translation_audit.json" \
  --case "$INPUT_DIR/case.json" \
  --out "$OUTPUT_DIR/result.json"

python3 "$SKILL_DIR/scripts/validate_result.py" \
  --result "$OUTPUT_DIR/result.json" \
  --case "$INPUT_DIR/case.json" \
  --out "$WORK_DIR/validation.json"

If case.json asks for additional QA/summary fields beyond translation, place them in $WORK_DIR/extra_fields.json (wrapped with value, status, evidence_ids, source_pages, note) and pass --extra-fields "$WORK_DIR/extra_fields.json" to make_result.py.

Exception Handling & Status Rules

  • failed: missing/corrupt input, encrypted PDF (password_required), missing extraction engine (pymupdf and pdftotext both absent), or missing translations on --strict.
  • partial: scanned PDF pages without text layer (needs_ocr when tesseract unavailable — never guess OCR text; inspect rendered page images if vision-capable or mark needs_ocr), unparsed table structure, remaining verification flags in manual_review_checklist, or missing optional output_contract items.
  • success: all translatable segments completed, verify_translation.py clean, validate_result.py ok: true, and no unresolved extraction gaps.

Minimal Example (Synthetic Illustration — Not a Formal Case Result)

Example input (examples/case.json, examples/sample_paper.md):

python3 scripts/prepare_case.py --input examples --work /tmp/ex_work --output /tmp/ex_out
python3 scripts/extract_segments.py --context /tmp/ex_work/case_context.json --work /tmp/ex_work
python3 scripts/build_glossary.py --segments /tmp/ex_work/segments.json --work /tmp/ex_work

Illustrative output excerpt (see examples/sample_bilingual_output.md):

{
  "para_id": "P-0001",
  "kind": "body",
  "source_pages": [1],
  "evidence_ids": ["doc-p1-b3"],
  "source_text": "Unlike prior methods, our Adaptive Sparse Attention (ASA) module does not require quadratic memory [1], reducing peak usage by 42.5%.",
  "translated_text": "与此前方法不同,本文提出的自适应稀疏注意力(ASA)模块不需要平方级内存 [1],可将峰值显存占用降低 42.5%。",
  "translation_basis": "Locked term: Adaptive Sparse Attention->自适应稀疏注意力, ASA->ASA; preserved negation 'does not require', citation [1], and metric 42.5%.",
  "status": "verified"
}

관련 스킬