SOURCE EXPLORER / 資料ブラウザー
style.py
実装と資料を、行ごとに確かめる。
日常訳はAIを用いて作成された翻訳です。人間の聖書学・原語の専門家による全訳の検証は確認されていません。既存の翻訳や原語資料と照らし合わせてお読みください。
1"""Translation style configuration models."""23from __future__ import annotations45from dataclasses import dataclass, field6from enum import Enum789class EquivalenceApproach(str, Enum):10"""Translation equivalence approach."""1112FORMAL = "formal" # Word-for-word, structure preserving13DYNAMIC = "dynamic" # Thought-for-thought, meaning preserving14OPTIMAL = "optimal" # Balance between formal and dynamic151617class GenderLanguage(str, Enum):18"""Gender language approach."""1920TRADITIONAL = "traditional" # Preserve masculine generics21MODERATE_INCLUSIVE = "moderate_inclusive" # Inclusive for clearly generic refs22FULLY_INCLUSIVE = "fully_inclusive" # Always use gender-neutral language232425class ReadabilityLevel(str, Enum):26"""Target readability level."""2728SCHOLARLY = "scholarly" # Academic/theological audience29GENERAL_PUBLIC = "general_public" # Everyday readers30WEB_NATIVE = "web_native" # Young adults raised on online media31CHILDREN = "children" # Simplified for younger readers323334class TheologicalTradition(str, Enum):35"""Theological interpretive tradition."""3637EVANGELICAL = "evangelical" # Protestant evangelical38CATHOLIC = "catholic" # Roman Catholic39ORTHODOX = "orthodox" # Eastern Orthodox40ECUMENICAL = "ecumenical" # Cross-traditional414243class TermConsistency(str, Enum):44"""Term translation consistency approach."""4546STRICT = "strict" # Always same translation for same term47BALANCED = "balanced" # Consistent for key terms, contextual for common words48CONTEXTUAL = "contextual" # Prioritize natural reading, vary by context495051class FormalityLevel(str, Enum):52"""Japanese formality level."""5354CASUAL = "casual" # Plain form (だ/である)55STANDARD = "standard" # Mainstream translation register (plain narrative)56POLITE = "polite" # Friendly です/ます narration (リビングバイブル-like)57FORMAL = "formal" # Highly formal/literary585960@dataclass61class TranslationStyle:62"""Configuration for translation style and approach.6364This dataclass encapsulates all configurable aspects of the65translation philosophy and target style.66"""6768equivalence_approach: EquivalenceApproach = EquivalenceApproach.DYNAMIC69gender_language: GenderLanguage = GenderLanguage.MODERATE_INCLUSIVE70readability_level: ReadabilityLevel = ReadabilityLevel.WEB_NATIVE71theological_tradition: TheologicalTradition = TheologicalTradition.EVANGELICAL72textual_basis: str = "MorphGNT/SBLGNT"73term_consistency: TermConsistency = TermConsistency.BALANCED74formality_level: FormalityLevel = FormalityLevel.STANDARD75avoid_archaic: list[str] = field(76default_factory=lambda: ["なり", "たり", "候"]77)78target_style_reference: str = "現代のウェブ記事・ナレーションのような平易な日本語"79additional_instructions: str | None = None8081def to_dict(self) -> dict:82"""Convert to dictionary for serialization."""83return {84"equivalence_approach": self.equivalence_approach.value,85"gender_language": self.gender_language.value,86"readability_level": self.readability_level.value,87"theological_tradition": self.theological_tradition.value,88"textual_basis": self.textual_basis,89"term_consistency": self.term_consistency.value,90"formality_level": self.formality_level.value,91"avoid_archaic": self.avoid_archaic,92"target_style_reference": self.target_style_reference,93"additional_instructions": self.additional_instructions,94}9596@classmethod97def from_dict(cls, data: dict) -> TranslationStyle:98"""Create from dictionary."""99return cls(100equivalence_approach=EquivalenceApproach(101data.get("equivalence_approach", "dynamic")102),103gender_language=GenderLanguage(104data.get("gender_language", "moderate_inclusive")105),106readability_level=ReadabilityLevel(107data.get("readability_level", "web_native")108),109theological_tradition=TheologicalTradition(110data.get("theological_tradition", "evangelical")111),112textual_basis=data.get("textual_basis", "MorphGNT/SBLGNT"),113term_consistency=TermConsistency(114data.get("term_consistency", "balanced")115),116formality_level=FormalityLevel(117data.get("formality_level", "standard")118),119avoid_archaic=data.get("avoid_archaic", ["なり", "たり", "候"]),120target_style_reference=data.get(121"target_style_reference", "現代のウェブ記事・ナレーションのような平易な日本語"122),123additional_instructions=data.get("additional_instructions"),124)125126127# Prompt text templates for each style option128129EQUIVALENCE_PROMPTS = {130EquivalenceApproach.FORMAL: """EQUIVALENCE APPROACH: Formal131- Prioritize word-for-word translation to preserve original structure132- Maintain source language word order where possible in Japanese133- Keep Greek/Hebrew idioms even if slightly unusual in Japanese134- Focus on consistency of form over natural readability""",135EquivalenceApproach.DYNAMIC: """EQUIVALENCE APPROACH: Dynamic/Functional136- Prioritize thought-for-thought translation over word-for-word literalism137- Ask "how would a native Japanese speaker naturally express this idea?"138- Preserve the meaning and impact, not necessarily the exact syntax139- Restructure sentences for natural Japanese flow when needed""",140EquivalenceApproach.OPTIMAL: """EQUIVALENCE APPROACH: Optimal Equivalence141- Balance form and meaning preservation142- Keep form where it doesn't impede comprehension143- Adjust form only when necessary for clear communication144- Preserve key rhetorical features of the original""",145}146147GENDER_PROMPTS = {148GenderLanguage.TRADITIONAL: """GENDER LANGUAGE: Traditional149- Preserve masculine generic references as in the original150- ἀδελφοί (adelphoi): render as "兄弟" (brothers)151- ἄνθρωπος (anthropos): use "人" but don't change gender-specific terms152- Maintain traditional patriarchal language where present""",153GenderLanguage.MODERATE_INCLUSIVE: """GENDER LANGUAGE: Moderate Inclusive154- Use gender-inclusive language for clearly generic references155- ἀδελφοί (adelphoi): render as "兄弟姉妹" when context indicates mixed group156- ἄνθρωπος (anthropos): use "人" or "人々" for generic humanity, not just "男"157- Preserve gender-specific language where the original clearly indicates it""",158GenderLanguage.FULLY_INCLUSIVE: """GENDER LANGUAGE: Fully Inclusive159- Use gender-neutral language throughout where possible160- ἀδελφοί (adelphoi): always render as "兄弟姉妹" or "きょうだい"161- Avoid masculine generics entirely162- Rephrase to eliminate unnecessary gendered terms""",163}164165READABILITY_PROMPTS = {166ReadabilityLevel.SCHOLARLY: """READABILITY: Scholarly167- Target academic and theological readers168- Use technical theological vocabulary with precision169- Preserve complex sentence structures when meaningful170- Prioritize accuracy over accessibility""",171ReadabilityLevel.GENERAL_PUBLIC: """READABILITY: General Public172- Target everyday readers, not scholars173- Avoid theological jargon; use accessible vocabulary174- Prefer common words over technical terms175- Aim for natural conversational Japanese""",176ReadabilityLevel.CHILDREN: """READABILITY: Children/Youth177- Use simple vocabulary appropriate for young readers178- Break complex sentences into shorter ones179- Explain difficult concepts within the translation180- Prioritize clarity and engagement""",181ReadabilityLevel.WEB_NATIVE: """READABILITY: Web-native (young adults, online-media register)182- Target readers in their 20s whose daily reading is online: news apps, blogs,183social media, and scripts/subtitles of popular Japanese creators184- Short sentences: one idea per sentence; prefer two short sentences over one long one185- Everyday vocabulary only — if a word would not appear in a LINE News article186or a popular YouTuber's narration, replace it with one that would187(遣わす→送る, 戒める→注意する, 憩わせる→休ませる, 〜のゆえに→〜だから)188- Prefer native Japanese words (和語) over stiff literary Sino-Japanese189compounds (漢語) when the meaning allows190- Sentence-initial connectives are welcome and natural (でも、だから、それで、そして)191- The rhythm should feel like clear spoken narration, not a printed literary text192- NEVER trade meaning for smoothness: meaning must stay exactly equivalent to193the Greek/Hebrew. When a concept is hard, say it in plain words — do not194omit or dilute it195- Keep every concrete content word from the source: distinct objects stay196distinct (rod AND staff, not staff twice), negated objects stay explicit197("fear no evil", not "fear nothing"), and events are not reinterpreted198("there was light", not "light appeared"). Modernize the wording, never199the content200- In poetry, plain vocabulary must still carry the imagery — keep every201picture (shepherd, valley, table, cup) vivid and concrete""",202}203204TRADITION_PROMPTS = {205TheologicalTradition.EVANGELICAL: """THEOLOGICAL TRADITION: Protestant Evangelical206- Follow Protestant canon and interpretive tradition207- Translate key theological terms in line with evangelical understanding208- Examples: δικαιοσύνη as "義" (righteousness), σωτηρία as "救い" (salvation)""",209TheologicalTradition.CATHOLIC: """THEOLOGICAL TRADITION: Catholic210- Follow Catholic canon and interpretive tradition211- Include deuterocanonical perspectives where relevant212- Use terminology consistent with Catholic teaching""",213TheologicalTradition.ORTHODOX: """THEOLOGICAL TRADITION: Eastern Orthodox214- Follow Orthodox canon and interpretive tradition215- Reflect Orthodox theological emphasis216- Preserve liturgical sensibility in translation""",217TheologicalTradition.ECUMENICAL: """THEOLOGICAL TRADITION: Ecumenical218- Seek common ground across Christian traditions219- Avoid translation choices that favor one tradition220- Use broadly acceptable theological terminology""",221}222223CONSISTENCY_PROMPTS = {224TermConsistency.STRICT: """TERM CONSISTENCY: Strict Concordance225- Always translate the same word with the same Japanese term226- Maintain rigid consistency across all occurrences227- Prioritize concordance over natural reading""",228TermConsistency.BALANCED: """TERM CONSISTENCY: Balanced229- Maintain consistent translation for key theological terms (provided in glossary)230- Allow contextual variation for common words where meaning shifts231- Prioritize natural reading over rigid concordance for non-technical vocabulary""",232TermConsistency.CONTEXTUAL: """TERM CONSISTENCY: Contextual233- Vary translation based on context and nuance234- Prioritize natural reading in each passage235- Use different translations for the same word when context differs""",236}237238FORMALITY_PROMPTS = {239FormalityLevel.CASUAL: """FORMALITY: Casual (だ/である)240- Use plain form throughout241- Suitable for personal reading and study242- More direct and intimate tone""",243FormalityLevel.STANDARD: """FORMALITY: Standard (mainstream translation register)244- Narrative, exposition, and poetry: plain form (である体/だ体), as in 新共同訳 and 口語訳245- Polite form (です/ます) ONLY inside quoted speech, when natural for the speaker246- Keep the same register consistently across every verse of a passage""",247FormalityLevel.POLITE: """FORMALITY: Polite friendly narration (です/ます)248- Narrate in warm, natural です/ます form, like リビングバイブル or a friendly storyteller249- Inside quoted speech, use whatever register fits the speaker and scene250- Keep the same narration register consistently across every verse of a passage""",251FormalityLevel.FORMAL: """FORMALITY: Formal/Literary252- Use formal literary style253- Suitable for liturgical and ceremonial use254- Elevated register with traditional phrasing""",255}256257258def build_system_prompt(style: TranslationStyle) -> str:259"""Build a system prompt from a TranslationStyle configuration.260261Args:262style: The translation style configuration.263264Returns:265Complete system prompt string.266"""267parts = [268"You are an expert Bible translator creating a modern Japanese translation.",269"",270"=== TRANSLATION PHILOSOPHY ===",271"",272EQUIVALENCE_PROMPTS[style.equivalence_approach],273"",274GENDER_PROMPTS[style.gender_language],275"",276READABILITY_PROMPTS[style.readability_level],277"",278TRADITION_PROMPTS[style.theological_tradition],279"",280f"TEXTUAL BASIS: {style.textual_basis}",281"- Follow the provided source text without incorporating textual variants",282"- Do not emend or correct based on other manuscript traditions",283"",284CONSISTENCY_PROMPTS[style.term_consistency],285"",286"=== TARGET AUDIENCE ===",287"The translation should be accessible to young adult Japanese nonbelievers who are not familiar with Christianity.",288"- Use vocabulary and expressions that require no prior church background",289"- Explain concepts through natural phrasing rather than relying on traditional Christian terminology",290"- Avoid insider language that would confuse those unfamiliar with the faith",291"- HOWEVER: No compromise should be made in conveying the true Biblical meaning of the text",292"- Accuracy to the original meaning takes absolute priority over accessibility",293"- When tension exists between accessibility and faithfulness, choose faithfulness",294"",295"=== TARGET STYLE ===",296f"Modern natural Japanese ({style.target_style_reference})",297"- Use contemporary vocabulary and grammar",298]299300if style.avoid_archaic:301archaic_str = "、".join(style.avoid_archaic)302parts.append(f"- Avoid archaic expressions ({archaic_str})")303304parts.append(FORMALITY_PROMPTS[style.formality_level].split("\n")[1])305parts.append(306"- Orthography: first-person singular is わたし (hiragana, not 私), "307"following mainstream Japanese Bible convention; keep orthography "308"consistent across a passage"309)310parts.append("- Prioritize clarity and accessibility")311312if style.additional_instructions:313parts.extend(["", "=== ADDITIONAL INSTRUCTIONS ===", style.additional_instructions])314315parts.extend(316[317"",318"=== LITERARY QUALITY (by genre) ===",319"Match the literary character of the source genre:",320"- Hebrew poetry (Psalms, poetic passages): preserve the parallel line structure,",321" concrete imagery, and quiet rhythm; keep lines terse — do not flatten into prose",322"- Narrative (Gospels, Genesis): clear, flowing storytelling prose;",323" preserve deliberate repetition and refrains (e.g. creation formulas)",324"- Epistles (Paul): keep the logical connectives (だから、なぜなら、しかし今や)",325" and the argument's flow visible; do not break one flowing thought into fragments",326"- Sayings/beatitudes: preserve the parallel formula across the whole series",327"",328"=== VERSE COHESION ===",329"A verse is often part of a longer sentence. Use the preceding and following",330"verses provided in CONTEXT to make your translation read as a smooth continuation:",331"- If the verse continues a sentence begun earlier, translate it so it flows",332" naturally from the preceding verse (no abrupt fragment openings)",333"- If the sentence continues into the next verse, end in a form that leads on naturally",334"- Keep terminology and register identical to the surrounding verses",335"",336"=== INPUT FORMAT ===",337"You will receive:",338"1. Source text (Greek for NT, Hebrew for OT)",339"2. Reference translations (historical Japanese and English)",340"3. Surrounding context (preceding and following verses)",341"4. Glossary terms to use consistently",342"",343"=== OUTPUT CONTRACT (strict) ===",344"Output ONLY the final Japanese translation of the target verse.",345"- No explanations, notes, romanization, or commentary",346"- No alternative renderings, no self-corrections, no English of any kind",347"- Decide on your final wording BEFORE writing; output exactly one rendering",348]349)350351return "\n".join(parts)352