Coverage for src / wiktextract / extractor / th / models.py: 100%
121 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-12 08:09 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-12 08:09 +0000
1from pydantic import BaseModel, ConfigDict, Field
4class ThaiBaseModel(BaseModel):
5 model_config = ConfigDict(
6 extra="forbid",
7 strict=True,
8 validate_assignment=True,
9 validate_default=True,
10 )
13class Sound(ThaiBaseModel):
14 zh_pron: str = Field(default="", description="Chinese word pronunciation")
15 ipa: str = Field(default="", description="International Phonetic Alphabet")
16 audio: str = Field(default="", description="Audio file name")
17 wav_url: str = ""
18 oga_url: str = ""
19 ogg_url: str = ""
20 mp3_url: str = ""
21 opus_url: str = ""
22 flac_url: str = ""
23 tags: list[str] = []
24 raw_tags: list[str] = []
25 homophone: str = ""
26 other: str = ""
27 roman: str = ""
28 rhymes: str = ""
29 enpr: str = ""
32class Example(ThaiBaseModel):
33 text: str
34 bold_text_offsets: list[tuple[int, int]] = []
35 translation: str = ""
36 bold_translation_offsets: list[tuple[int, int]] = []
37 literal_meaning: str = ""
38 bold_literal_offsets: list[tuple[int, int]] = []
39 roman: str = Field(
40 default="", description="Romanization of the example sentence"
41 )
42 bold_roman_offsets: list[tuple[int, int]] = []
43 ref: str = Field(
44 default="",
45 description="Source of the sentence, like book title and page number",
46 )
47 ruby: list[tuple[str, ...]] = Field(
48 default=[], description="Japanese Kanji and furigana"
49 )
50 tags: list[str] = []
51 raw_tags: list[str] = []
52 categories: list[str] = Field(default=[], exclude=True)
53 sounds: list[Sound] = []
56class AltForm(ThaiBaseModel):
57 word: str
58 roman: str = ""
61class Classifier(ThaiBaseModel):
62 classifier: str = ""
63 tags: list[str] = []
64 raw_tags: list[str] = []
67class Sense(ThaiBaseModel):
68 glosses: list[str] = []
69 tags: list[str] = []
70 raw_tags: list[str] = []
71 categories: list[str] = []
72 examples: list[Example] = []
73 form_of: list[AltForm] = []
74 alt_of: list[AltForm] = []
75 topics: list[str] = []
76 classifiers: list[Classifier] = []
79class Form(ThaiBaseModel):
80 form: str
81 tags: list[str] = []
82 raw_tags: list[str] = []
83 roman: str = ""
84 ruby: list[tuple[str, ...]] = []
87class Translation(ThaiBaseModel):
88 lang_code: str = Field(
89 description="Wiktionary language code of the translation term",
90 )
91 lang: str = Field(description="Translation language name")
92 word: str = Field(description="Translation term")
93 sense: str = Field(default="", description="Translation gloss")
94 tags: list[str] = []
95 raw_tags: list[str] = []
96 roman: str = ""
97 lit: str = Field(default="", description="Literal translation")
98 source: str = ""
101class Linkage(ThaiBaseModel):
102 word: str
103 tags: list[str] = []
104 raw_tags: list[str] = []
105 roman: str = ""
106 source: str = ""
107 sense: str = ""
110class Descendant(ThaiBaseModel):
111 lang_code: str = Field(description="Wiktionary language code")
112 lang: str = Field(description="Language name")
113 word: str
114 roman: str = ""
115 tags: list[str] = []
116 raw_tags: list[str] = []
117 descendants: list["Descendant"] = []
118 sense: str = ""
119 ruby: list[tuple[str, str]] = []
122class Hyphenation(ThaiBaseModel):
123 parts: list[str] = []
124 tags: list[str] = []
125 raw_tags: list[str] = []
128class WordEntry(ThaiBaseModel):
129 model_config = ConfigDict(title="Thai Wiktionary")
130 word: str = Field(description="Word string", min_length=1)
131 lang_code: str = Field(description="Wiktionary language code", min_length=1)
132 lang: str = Field(description="Localized language name", min_length=1)
133 pos: str = Field(description="Part of speech type", min_length=1)
134 pos_title: str = ""
135 senses: list[Sense] = []
136 categories: list[str] = []
137 tags: list[str] = []
138 raw_tags: list[str] = []
139 etymology_texts: list[str] = []
140 classifiers: list[Classifier] = []
141 forms: list[Form] = []
142 translations: list[Translation] = []
143 antonyms: list[Linkage] = []
144 synonyms: list[Linkage] = []
145 derived: list[Linkage] = []
146 related: list[Linkage] = []
147 descendants: list[Descendant] = []
148 anagrams: list[Linkage] = []
149 notes: list[str] = []
150 hyponyms: list[Linkage] = []
151 hypernyms: list[Linkage] = []
152 idioms: list[Linkage] = []
153 coordinate_terms: list[Linkage] = []
154 sounds: list[Sound] = []
155 hyphenations: list[Hyphenation] = []
156 abbreviations: list[Linkage] = []
157 proverbs: list[Linkage] = []
158 literal_meaning: str = ""
159 redirects: list[str] = []