Coverage for src / wiktextract / extractor / ms / models.py: 100%
101 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 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)
71 source: str = ""
74class Hyphenation(MalayBaseModel):
75 parts: list[str] = []
76 tags: list[str] = []
77 raw_tags: list[str] = []
80class Sound(MalayBaseModel):
81 zh_pron: str = Field(default="", description="Chinese word pronunciation")
82 ipa: str = Field(default="", description="International Phonetic Alphabet")
83 audio: str = Field(default="", description="Audio file name")
84 wav_url: str = ""
85 oga_url: str = ""
86 ogg_url: str = ""
87 mp3_url: str = ""
88 opus_url: str = ""
89 flac_url: str = ""
90 tags: list[str] = []
91 raw_tags: list[str] = []
92 homophone: str = ""
93 other: str = ""
94 roman: str = ""
95 rhymes: str = ""
96 categories: list[str] = Field(default=[], exclude=True)
97 hyphenations: list[Hyphenation] = Field(default=[], exclude=True)
100class Classifier(MalayBaseModel):
101 classifier: str = ""
102 tags: list[str] = []
103 raw_tags: list[str] = []
106class WordEntry(MalayBaseModel):
107 model_config = ConfigDict(title="Malay Wiktionary")
108 word: str = Field(description="Word string")
109 lang_code: str = Field(description="Wiktionary language code")
110 lang: str = Field(description="Localized language name")
111 pos: str = Field(description="Part of speech type")
112 pos_title: str = ""
113 senses: list[Sense] = []
114 categories: list[str] = []
115 tags: list[str] = []
116 raw_tags: list[str] = []
117 forms: list[Form] = []
118 etymology_texts: list[str] = []
119 antonyms: list[Linkage] = []
120 synonyms: list[Linkage] = []
121 translations: list[Translation] = []
122 hypernyms: list[Linkage] = []
123 coordinate_terms: list[Linkage] = []
124 hyponyms: list[Linkage] = []
125 hyphenations: list[Hyphenation] = []
126 sounds: list[Sound] = []
127 derived: list[Linkage] = []
128 anagrams: list[Linkage] = []
129 proverbs: list[Linkage] = []
130 related: list[Linkage] = []
131 notes: list[str] = []
132 classifiers: list[Classifier] = []