Coverage for src/wiktextract/extractor/ms/models.py: 100%
95 statements
« prev ^ index » next coverage.py v7.10.3, created at 2025-08-15 05:18 +0000
« prev ^ index » next coverage.py v7.10.3, created at 2025-08-15 05:18 +0000
1from pydantic import BaseModel, ConfigDict, Field
4class MalayBaseModel(BaseModel):
5 model_config = ConfigDict(
6 extra="forbid",
7 strict=True,
8 validate_assignment=True,
9 validate_default=True,
10 )
13class Example(MalayBaseModel):
14 text: str
15 bold_text_offsets: list[tuple[int, int]] = []
16 translation: str = ""
17 bold_translation_offsets: list[tuple[int, int]] = []
18 roman: str = ""
19 bold_roman_offsets: list[tuple[int, int]] = []
20 ref: str = ""
21 tags: list[str] = []
22 raw_tags: list[str] = []
23 literal_meaning: str = ""
24 bold_literal_offsets: list[tuple[int, int]] = []
27class AltForm(MalayBaseModel):
28 word: str
31class Attestation(MalayBaseModel):
32 date: str
35class Sense(MalayBaseModel):
36 glosses: list[str] = []
37 tags: list[str] = []
38 raw_tags: list[str] = []
39 topics: list[str] = []
40 categories: list[str] = []
41 examples: list[Example] = []
42 form_of: list[AltForm] = []
43 alt_of: list[AltForm] = []
44 attestations: list[Attestation] = []
47class Form(MalayBaseModel):
48 form: str
49 tags: list[str] = []
50 raw_tags: list[str] = []
53class Linkage(MalayBaseModel):
54 word: str
55 tags: list[str] = []
56 raw_tags: list[str] = []
57 sense: str = ""
60class Translation(MalayBaseModel):
61 lang_code: str = Field(
62 description="Wiktionary language code of the translation term",
63 )
64 lang: str = Field(description="Translation language name")
65 word: str = Field(description="Translation term")
66 sense: str = Field(default="", description="Translation gloss")
67 tags: list[str] = []
68 raw_tags: list[str] = []
69 roman: str = ""
70 categories: list[str] = Field(default=[], exclude=True)
73class Hyphenation(MalayBaseModel):
74 parts: list[str] = []
75 tags: list[str] = []
76 raw_tags: list[str] = []
79class Sound(MalayBaseModel):
80 zh_pron: str = Field(default="", description="Chinese word pronunciation")
81 ipa: str = Field(default="", description="International Phonetic Alphabet")
82 audio: str = Field(default="", description="Audio file name")
83 wav_url: str = ""
84 oga_url: str = ""
85 ogg_url: str = ""
86 mp3_url: str = ""
87 opus_url: str = ""
88 flac_url: str = ""
89 tags: list[str] = []
90 raw_tags: list[str] = []
91 homophone: str = ""
92 other: str = ""
93 roman: str = ""
94 rhymes: str = ""
95 categories: list[str] = Field(default=[], exclude=True)
96 hyphenations: list[Hyphenation] = Field(default=[], exclude=True)
99class WordEntry(MalayBaseModel):
100 model_config = ConfigDict(title="Malay Wiktionary")
101 word: str = Field(description="Word string")
102 lang_code: str = Field(description="Wiktionary language code")
103 lang: str = Field(description="Localized language name")
104 pos: str = Field(description="Part of speech type")
105 pos_title: str = ""
106 senses: list[Sense] = []
107 categories: list[str] = []
108 tags: list[str] = []
109 raw_tags: list[str] = []
110 forms: list[Form] = []
111 etymology_text: str = ""
112 antonyms: list[Linkage] = []
113 synonyms: list[Linkage] = []
114 translations: list[Translation] = []
115 hypernyms: list[Linkage] = []
116 coordinate_terms: list[Linkage] = []
117 hyponyms: list[Linkage] = []
118 hyphenations: list[Hyphenation] = []
119 sounds: list[Sound] = []
120 derived: list[Linkage] = []
121 anagrams: list[Linkage] = []
122 proverbs: list[Linkage] = []
123 related: list[Linkage] = []
124 notes: list[str] = []