OPEN SOURCE
software/src/models/glossary.py
このサイトで読み、必要なファイルを保存できます。
日常訳はAIを用いて作成された翻訳です。人間の聖書学・原語の専門家による全訳の検証は確認されていません。既存の翻訳や原語資料と照らし合わせてお読みください。
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."""1213CHRISTOLOGY = "christology" # Study of Christ14SOTERIOLOGY = "soteriology" # Study of salvation15ESCHATOLOGY = "eschatology" # Study of end times16PNEUMATOLOGY = "pneumatology" # Study of the Spirit17ECCLESIOLOGY = "ecclesiology" # Study of the church18HAMARTIOLOGY = "hamartiology" # Study of sin19THEOLOGY_PROPER = "theology_proper" # Study of God20ANTHROPOLOGY = "anthropology" # Study of humanity21GENERAL = "general" # General theological terms222324class EnhancedGlossaryTerm(BaseModel):25"""A theological term with rich metadata for consistent translation guidance.2627This model is backward compatible with the original GlossaryTerm,28adding optional fields for enhanced functionality.29"""3031# Core fields (backward compatible with GlossaryTerm)32original: str = Field(..., description="Original Greek/Hebrew term")33transliteration: str = Field(..., description="Romanized form")34japanese: str = Field(..., description="Standard Japanese translation")35english: str = Field(..., description="English equivalent")36notes: str | None = Field(None, description="Usage notes or context")3738# Morphological fields for inflection matching39lemma: str | None = Field(40None,41description="Dictionary form (lemma) of the term for morphological matching",42)43inflected_forms: list[str] = Field(44default_factory=list,45description="Known inflected forms of this term (e.g., conjugations, declensions)",46)47strongs_number: str | None = Field(48None,49description="Strong's Concordance number (e.g., 'G3056' for logos)",50)5152# Enhanced fields53definition: str | None = Field(54None, description="Detailed definition of the term"55)56semantic_range: list[str] = Field(57default_factory=list,58description="Possible meanings and nuances of the term",59)60domain: TheologicalDomain = Field(61default=TheologicalDomain.GENERAL,62description="Theological domain this term belongs to",63)64usage_examples: list[str] = Field(65default_factory=list,66description="Example verses or usages",67)68frequency: int = Field(69default=0,70ge=0,71description="Frequency of occurrence in the source text",72)73related_terms: list[str] = Field(74default_factory=list,75description="Cross-references to related terms by their original form",76)77avoid_translations: list[str] = Field(78default_factory=list,79description="Japanese translations to avoid for this term",80)8182def has_enhanced_metadata(self) -> bool:83"""Check if this term has any enhanced metadata beyond the core fields."""84return bool(85self.definition86or self.semantic_range87or self.domain != TheologicalDomain.GENERAL88or self.usage_examples89or self.frequency > 090or self.related_terms91or self.avoid_translations92)9394def get_all_matchable_forms(self) -> list[str]:95"""Get all forms that can be used for matching (original, lemma, inflections).9697Returns:98List of all matchable string forms.99"""100forms = [self.original]101if self.lemma and self.lemma != self.original:102forms.append(self.lemma)103forms.extend(self.inflected_forms)104return forms105106107# Type alias for backward compatibility108GlossaryTerm = EnhancedGlossaryTerm109