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