"""Translation style configuration models.""" from __future__ import annotations from dataclasses import dataclass, field from enum import Enum class EquivalenceApproach(str, Enum): """Translation equivalence approach.""" FORMAL = "formal" # Word-for-word, structure preserving DYNAMIC = "dynamic" # Thought-for-thought, meaning preserving OPTIMAL = "optimal" # Balance between formal and dynamic class GenderLanguage(str, Enum): """Gender language approach.""" TRADITIONAL = "traditional" # Preserve masculine generics MODERATE_INCLUSIVE = "moderate_inclusive" # Inclusive for clearly generic refs FULLY_INCLUSIVE = "fully_inclusive" # Always use gender-neutral language class ReadabilityLevel(str, Enum): """Target readability level.""" SCHOLARLY = "scholarly" # Academic/theological audience GENERAL_PUBLIC = "general_public" # Everyday readers WEB_NATIVE = "web_native" # Young adults raised on online media CHILDREN = "children" # Simplified for younger readers class TheologicalTradition(str, Enum): """Theological interpretive tradition.""" EVANGELICAL = "evangelical" # Protestant evangelical CATHOLIC = "catholic" # Roman Catholic ORTHODOX = "orthodox" # Eastern Orthodox ECUMENICAL = "ecumenical" # Cross-traditional class TermConsistency(str, Enum): """Term translation consistency approach.""" STRICT = "strict" # Always same translation for same term BALANCED = "balanced" # Consistent for key terms, contextual for common words CONTEXTUAL = "contextual" # Prioritize natural reading, vary by context class FormalityLevel(str, Enum): """Japanese formality level.""" CASUAL = "casual" # Plain form (だ/である) STANDARD = "standard" # Mainstream translation register (plain narrative) POLITE = "polite" # Friendly です/ます narration (リビングバイブル-like) FORMAL = "formal" # Highly formal/literary @dataclass class TranslationStyle: """Configuration for translation style and approach. This dataclass encapsulates all configurable aspects of the translation philosophy and target style. """ equivalence_approach: EquivalenceApproach = EquivalenceApproach.DYNAMIC gender_language: GenderLanguage = GenderLanguage.MODERATE_INCLUSIVE readability_level: ReadabilityLevel = ReadabilityLevel.WEB_NATIVE theological_tradition: TheologicalTradition = TheologicalTradition.EVANGELICAL textual_basis: str = "MorphGNT/SBLGNT" term_consistency: TermConsistency = TermConsistency.BALANCED formality_level: FormalityLevel = FormalityLevel.STANDARD avoid_archaic: list[str] = field( default_factory=lambda: ["なり", "たり", "候"] ) target_style_reference: str = "現代のウェブ記事・ナレーションのような平易な日本語" additional_instructions: str | None = None def to_dict(self) -> dict: """Convert to dictionary for serialization.""" return { "equivalence_approach": self.equivalence_approach.value, "gender_language": self.gender_language.value, "readability_level": self.readability_level.value, "theological_tradition": self.theological_tradition.value, "textual_basis": self.textual_basis, "term_consistency": self.term_consistency.value, "formality_level": self.formality_level.value, "avoid_archaic": self.avoid_archaic, "target_style_reference": self.target_style_reference, "additional_instructions": self.additional_instructions, } @classmethod def from_dict(cls, data: dict) -> TranslationStyle: """Create from dictionary.""" return cls( equivalence_approach=EquivalenceApproach( data.get("equivalence_approach", "dynamic") ), gender_language=GenderLanguage( data.get("gender_language", "moderate_inclusive") ), readability_level=ReadabilityLevel( data.get("readability_level", "web_native") ), theological_tradition=TheologicalTradition( data.get("theological_tradition", "evangelical") ), textual_basis=data.get("textual_basis", "MorphGNT/SBLGNT"), term_consistency=TermConsistency( data.get("term_consistency", "balanced") ), formality_level=FormalityLevel( data.get("formality_level", "standard") ), avoid_archaic=data.get("avoid_archaic", ["なり", "たり", "候"]), target_style_reference=data.get( "target_style_reference", "現代のウェブ記事・ナレーションのような平易な日本語" ), additional_instructions=data.get("additional_instructions"), ) # Prompt text templates for each style option EQUIVALENCE_PROMPTS = { EquivalenceApproach.FORMAL: """EQUIVALENCE APPROACH: Formal - Prioritize word-for-word translation to preserve original structure - Maintain source language word order where possible in Japanese - Keep Greek/Hebrew idioms even if slightly unusual in Japanese - Focus on consistency of form over natural readability""", EquivalenceApproach.DYNAMIC: """EQUIVALENCE APPROACH: Dynamic/Functional - Prioritize thought-for-thought translation over word-for-word literalism - Ask "how would a native Japanese speaker naturally express this idea?" - Preserve the meaning and impact, not necessarily the exact syntax - Restructure sentences for natural Japanese flow when needed""", EquivalenceApproach.OPTIMAL: """EQUIVALENCE APPROACH: Optimal Equivalence - Balance form and meaning preservation - Keep form where it doesn't impede comprehension - Adjust form only when necessary for clear communication - Preserve key rhetorical features of the original""", } GENDER_PROMPTS = { GenderLanguage.TRADITIONAL: """GENDER LANGUAGE: Traditional - Preserve masculine generic references as in the original - ἀδελφοί (adelphoi): render as "兄弟" (brothers) - ἄνθρωπος (anthropos): use "人" but don't change gender-specific terms - Maintain traditional patriarchal language where present""", GenderLanguage.MODERATE_INCLUSIVE: """GENDER LANGUAGE: Moderate Inclusive - Use gender-inclusive language for clearly generic references - ἀδελφοί (adelphoi): render as "兄弟姉妹" when context indicates mixed group - ἄνθρωπος (anthropos): use "人" or "人々" for generic humanity, not just "男" - Preserve gender-specific language where the original clearly indicates it""", GenderLanguage.FULLY_INCLUSIVE: """GENDER LANGUAGE: Fully Inclusive - Use gender-neutral language throughout where possible - ἀδελφοί (adelphoi): always render as "兄弟姉妹" or "きょうだい" - Avoid masculine generics entirely - Rephrase to eliminate unnecessary gendered terms""", } READABILITY_PROMPTS = { ReadabilityLevel.SCHOLARLY: """READABILITY: Scholarly - Target academic and theological readers - Use technical theological vocabulary with precision - Preserve complex sentence structures when meaningful - Prioritize accuracy over accessibility""", ReadabilityLevel.GENERAL_PUBLIC: """READABILITY: General Public - Target everyday readers, not scholars - Avoid theological jargon; use accessible vocabulary - Prefer common words over technical terms - Aim for natural conversational Japanese""", ReadabilityLevel.CHILDREN: """READABILITY: Children/Youth - Use simple vocabulary appropriate for young readers - Break complex sentences into shorter ones - Explain difficult concepts within the translation - Prioritize clarity and engagement""", ReadabilityLevel.WEB_NATIVE: """READABILITY: Web-native (young adults, online-media register) - Target readers in their 20s whose daily reading is online: news apps, blogs, social media, and scripts/subtitles of popular Japanese creators - Short sentences: one idea per sentence; prefer two short sentences over one long one - Everyday vocabulary only — if a word would not appear in a LINE News article or a popular YouTuber's narration, replace it with one that would (遣わす→送る, 戒める→注意する, 憩わせる→休ませる, 〜のゆえに→〜だから) - Prefer native Japanese words (和語) over stiff literary Sino-Japanese compounds (漢語) when the meaning allows - Sentence-initial connectives are welcome and natural (でも、だから、それで、そして) - The rhythm should feel like clear spoken narration, not a printed literary text - NEVER trade meaning for smoothness: meaning must stay exactly equivalent to the Greek/Hebrew. When a concept is hard, say it in plain words — do not omit or dilute it - Keep every concrete content word from the source: distinct objects stay distinct (rod AND staff, not staff twice), negated objects stay explicit ("fear no evil", not "fear nothing"), and events are not reinterpreted ("there was light", not "light appeared"). Modernize the wording, never the content - In poetry, plain vocabulary must still carry the imagery — keep every picture (shepherd, valley, table, cup) vivid and concrete""", } TRADITION_PROMPTS = { TheologicalTradition.EVANGELICAL: """THEOLOGICAL TRADITION: Protestant Evangelical - Follow Protestant canon and interpretive tradition - Translate key theological terms in line with evangelical understanding - Examples: δικαιοσύνη as "義" (righteousness), σωτηρία as "救い" (salvation)""", TheologicalTradition.CATHOLIC: """THEOLOGICAL TRADITION: Catholic - Follow Catholic canon and interpretive tradition - Include deuterocanonical perspectives where relevant - Use terminology consistent with Catholic teaching""", TheologicalTradition.ORTHODOX: """THEOLOGICAL TRADITION: Eastern Orthodox - Follow Orthodox canon and interpretive tradition - Reflect Orthodox theological emphasis - Preserve liturgical sensibility in translation""", TheologicalTradition.ECUMENICAL: """THEOLOGICAL TRADITION: Ecumenical - Seek common ground across Christian traditions - Avoid translation choices that favor one tradition - Use broadly acceptable theological terminology""", } CONSISTENCY_PROMPTS = { TermConsistency.STRICT: """TERM CONSISTENCY: Strict Concordance - Always translate the same word with the same Japanese term - Maintain rigid consistency across all occurrences - Prioritize concordance over natural reading""", TermConsistency.BALANCED: """TERM CONSISTENCY: Balanced - Maintain consistent translation for key theological terms (provided in glossary) - Allow contextual variation for common words where meaning shifts - Prioritize natural reading over rigid concordance for non-technical vocabulary""", TermConsistency.CONTEXTUAL: """TERM CONSISTENCY: Contextual - Vary translation based on context and nuance - Prioritize natural reading in each passage - Use different translations for the same word when context differs""", } FORMALITY_PROMPTS = { FormalityLevel.CASUAL: """FORMALITY: Casual (だ/である) - Use plain form throughout - Suitable for personal reading and study - More direct and intimate tone""", FormalityLevel.STANDARD: """FORMALITY: Standard (mainstream translation register) - Narrative, exposition, and poetry: plain form (である体/だ体), as in 新共同訳 and 口語訳 - Polite form (です/ます) ONLY inside quoted speech, when natural for the speaker - Keep the same register consistently across every verse of a passage""", FormalityLevel.POLITE: """FORMALITY: Polite friendly narration (です/ます) - Narrate in warm, natural です/ます form, like リビングバイブル or a friendly storyteller - Inside quoted speech, use whatever register fits the speaker and scene - Keep the same narration register consistently across every verse of a passage""", FormalityLevel.FORMAL: """FORMALITY: Formal/Literary - Use formal literary style - Suitable for liturgical and ceremonial use - Elevated register with traditional phrasing""", } def build_system_prompt(style: TranslationStyle) -> str: """Build a system prompt from a TranslationStyle configuration. Args: style: The translation style configuration. Returns: Complete system prompt string. """ parts = [ "You are an expert Bible translator creating a modern Japanese translation.", "", "=== TRANSLATION PHILOSOPHY ===", "", EQUIVALENCE_PROMPTS[style.equivalence_approach], "", GENDER_PROMPTS[style.gender_language], "", READABILITY_PROMPTS[style.readability_level], "", TRADITION_PROMPTS[style.theological_tradition], "", f"TEXTUAL BASIS: {style.textual_basis}", "- Follow the provided source text without incorporating textual variants", "- Do not emend or correct based on other manuscript traditions", "", CONSISTENCY_PROMPTS[style.term_consistency], "", "=== TARGET AUDIENCE ===", "The translation should be accessible to young adult Japanese nonbelievers who are not familiar with Christianity.", "- Use vocabulary and expressions that require no prior church background", "- Explain concepts through natural phrasing rather than relying on traditional Christian terminology", "- Avoid insider language that would confuse those unfamiliar with the faith", "- HOWEVER: No compromise should be made in conveying the true Biblical meaning of the text", "- Accuracy to the original meaning takes absolute priority over accessibility", "- When tension exists between accessibility and faithfulness, choose faithfulness", "", "=== TARGET STYLE ===", f"Modern natural Japanese ({style.target_style_reference})", "- Use contemporary vocabulary and grammar", ] if style.avoid_archaic: archaic_str = "、".join(style.avoid_archaic) parts.append(f"- Avoid archaic expressions ({archaic_str})") parts.append(FORMALITY_PROMPTS[style.formality_level].split("\n")[1]) parts.append( "- Orthography: first-person singular is わたし (hiragana, not 私), " "following mainstream Japanese Bible convention; keep orthography " "consistent across a passage" ) parts.append("- Prioritize clarity and accessibility") if style.additional_instructions: parts.extend(["", "=== ADDITIONAL INSTRUCTIONS ===", style.additional_instructions]) parts.extend( [ "", "=== LITERARY QUALITY (by genre) ===", "Match the literary character of the source genre:", "- Hebrew poetry (Psalms, poetic passages): preserve the parallel line structure,", " concrete imagery, and quiet rhythm; keep lines terse — do not flatten into prose", "- Narrative (Gospels, Genesis): clear, flowing storytelling prose;", " preserve deliberate repetition and refrains (e.g. creation formulas)", "- Epistles (Paul): keep the logical connectives (だから、なぜなら、しかし今や)", " and the argument's flow visible; do not break one flowing thought into fragments", "- Sayings/beatitudes: preserve the parallel formula across the whole series", "", "=== VERSE COHESION ===", "A verse is often part of a longer sentence. Use the preceding and following", "verses provided in CONTEXT to make your translation read as a smooth continuation:", "- If the verse continues a sentence begun earlier, translate it so it flows", " naturally from the preceding verse (no abrupt fragment openings)", "- If the sentence continues into the next verse, end in a form that leads on naturally", "- Keep terminology and register identical to the surrounding verses", "", "=== INPUT FORMAT ===", "You will receive:", "1. Source text (Greek for NT, Hebrew for OT)", "2. Reference translations (historical Japanese and English)", "3. Surrounding context (preceding and following verses)", "4. Glossary terms to use consistently", "", "=== OUTPUT CONTRACT (strict) ===", "Output ONLY the final Japanese translation of the target verse.", "- No explanations, notes, romanization, or commentary", "- No alternative renderings, no self-corrections, no English of any kind", "- Decide on your final wording BEFORE writing; output exactly one rendering", ] ) return "\n".join(parts)