Coverage for src/wiktextract/extractor/vi/models.py: 100%
96 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-09-12 08:27 +0000
« prev ^ index » next coverage.py v7.10.6, created at 2025-09-12 08:27 +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 Sense(VietnameseBaseModel):
42 glosses: list[str] = []
43 tags: list[str] = []
44 raw_tags: list[str] = []
45 categories: list[str] = []
46 topics: list[str] = []
47 examples: list[Example] = []
48 form_of: list[AltForm] = []
49 alt_of: list[AltForm] = []
52class Linkage(VietnameseBaseModel):
53 word: str
54 tags: list[str] = []
55 raw_tags: list[str] = []
56 roman: str = ""
57 sense: str = ""
58 other: str = ""
59 translation: str = ""
60 senses: list[str] = []
63class Form(VietnameseBaseModel):
64 form: str
65 tags: list[str] = []
66 raw_tags: list[str] = []
67 roman: str = ""
68 sense: str = ""
71class Translation(VietnameseBaseModel):
72 lang_code: str = Field(
73 description="Wiktionary language code of the translation term",
74 )
75 lang: str = Field(description="Translation language name")
76 word: str = Field(description="Translation term")
77 sense: str = Field(default="", description="Translation gloss")
78 tags: list[str] = []
79 raw_tags: list[str] = []
80 roman: str = ""
81 lit: str = Field(default="", description="Literal translation")
82 source: str = ""
83 other: str = ""
86class Sound(VietnameseBaseModel):
87 ipa: str = Field(default="", description="International Phonetic Alphabet")
88 tags: list[str] = []
89 raw_tags: list[str] = []
90 audio: str = Field(default="", description="Audio file name")
91 wav_url: str = ""
92 oga_url: str = ""
93 ogg_url: str = ""
94 mp3_url: str = ""
95 opus_url: str = ""
96 flac_url: str = ""
97 rhymes: str = ""
100class Hyphenation(VietnameseBaseModel):
101 parts: list[str] = []
104class WordEntry(VietnameseBaseModel):
105 model_config = ConfigDict(title="Vietnamese Wiktionary")
106 word: str = Field(description="Word string")
107 lang_code: str = Field(description="Wiktionary language code")
108 lang: str = Field(description="Localized language name")
109 pos: str = Field(description="Part of speech type")
110 pos_title: str = ""
111 senses: list[Sense] = []
112 categories: list[str] = []
113 tags: list[str] = []
114 raw_tags: list[str] = []
115 antonyms: list[Linkage] = []
116 synonyms: list[Linkage] = []
117 coordinate_terms: list[Linkage] = []
118 derived: list[Linkage] = []
119 related: list[Linkage] = []
120 holonyms: list[Linkage] = []
121 hypernyms: list[Linkage] = []
122 hyponyms: list[Linkage] = []
123 meronyms: list[Linkage] = []
124 forms: list[Form] = []
125 translations: list[Translation] = []
126 sounds: list[Sound] = []
127 etymology_text: str = ""
128 hyphenations: list[Hyphenation] = []
129 notes: list[str] = []
130 anagrams: list[Linkage] = []