公開前の確認用サイト
日常訳NICHIJOYAKUEnglish ↗

OPEN SOURCE

software/src/models/glossary.py

このサイトで読み、必要なファイルを保存できます。

日常訳はAIを用いて作成された翻訳です。人間の聖書学・原語の専門家による全訳の検証は確認されていません。既存の翻訳や原語資料と照らし合わせてお読みください。

← オープンソースの案内へ

software/src/models/glossary.py109 行このファイルを保存 ↓

ZIPに含まれるものと同じ公開ソースです。行番号から、その行へのリンクを保存できます。

ファイルの確認情報SHA-256 70106dfb88d92925621256b9fde0ccd85b2f30a234b6d0613528228a731cd425
1"""Enhanced glossary models with rich metadata for theological terms."""23from __future__ import annotations45from enum import Enum67from pydantic import BaseModel, Field8910class TheologicalDomain(str, Enum):11    """Domain categories for theological terms."""1213    CHRISTOLOGY = "christology"  # Study of Christ14    SOTERIOLOGY = "soteriology"  # Study of salvation15    ESCHATOLOGY = "eschatology"  # Study of end times16    PNEUMATOLOGY = "pneumatology"  # Study of the Spirit17    ECCLESIOLOGY = "ecclesiology"  # Study of the church18    HAMARTIOLOGY = "hamartiology"  # Study of sin19    THEOLOGY_PROPER = "theology_proper"  # Study of God20    ANTHROPOLOGY = "anthropology"  # Study of humanity21    GENERAL = "general"  # General theological terms222324class EnhancedGlossaryTerm(BaseModel):25    """A theological term with rich metadata for consistent translation guidance.2627    This model is backward compatible with the original GlossaryTerm,28    adding optional fields for enhanced functionality.29    """3031    # Core fields (backward compatible with GlossaryTerm)32    original: str = Field(..., description="Original Greek/Hebrew term")33    transliteration: str = Field(..., description="Romanized form")34    japanese: str = Field(..., description="Standard Japanese translation")35    english: str = Field(..., description="English equivalent")36    notes: str | None = Field(None, description="Usage notes or context")3738    # Morphological fields for inflection matching39    lemma: str | None = Field(40        None,41        description="Dictionary form (lemma) of the term for morphological matching",42    )43    inflected_forms: list[str] = Field(44        default_factory=list,45        description="Known inflected forms of this term (e.g., conjugations, declensions)",46    )47    strongs_number: str | None = Field(48        None,49        description="Strong's Concordance number (e.g., 'G3056' for logos)",50    )5152    # Enhanced fields53    definition: str | None = Field(54        None, description="Detailed definition of the term"55    )56    semantic_range: list[str] = Field(57        default_factory=list,58        description="Possible meanings and nuances of the term",59    )60    domain: TheologicalDomain = Field(61        default=TheologicalDomain.GENERAL,62        description="Theological domain this term belongs to",63    )64    usage_examples: list[str] = Field(65        default_factory=list,66        description="Example verses or usages",67    )68    frequency: int = Field(69        default=0,70        ge=0,71        description="Frequency of occurrence in the source text",72    )73    related_terms: list[str] = Field(74        default_factory=list,75        description="Cross-references to related terms by their original form",76    )77    avoid_translations: list[str] = Field(78        default_factory=list,79        description="Japanese translations to avoid for this term",80    )8182    def has_enhanced_metadata(self) -> bool:83        """Check if this term has any enhanced metadata beyond the core fields."""84        return bool(85            self.definition86            or self.semantic_range87            or self.domain != TheologicalDomain.GENERAL88            or self.usage_examples89            or self.frequency > 090            or self.related_terms91            or self.avoid_translations92        )9394    def get_all_matchable_forms(self) -> list[str]:95        """Get all forms that can be used for matching (original, lemma, inflections).9697        Returns:98            List of all matchable string forms.99        """100        forms = [self.original]101        if self.lemma and self.lemma != self.original:102            forms.append(self.lemma)103        forms.extend(self.inflected_forms)104        return forms105106107# Type alias for backward compatibility108GlossaryTerm = EnhancedGlossaryTerm109