Coverage for src/wiktextract/extractor/ku/models.py: 100%
103 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 KurdishBaseModel(BaseModel):
5 model_config = ConfigDict(
6 extra="forbid",
7 strict=True,
8 validate_assignment=True,
9 validate_default=True,
10 )
13class Sound(KurdishBaseModel):
14 ipa: str = ""
15 audio: str = Field(default="", description="Audio file name")
16 wav_url: str = ""
17 oga_url: str = ""
18 ogg_url: str = ""
19 mp3_url: str = ""
20 opus_url: str = ""
21 flac_url: str = ""
22 tags: list[str] = []
23 raw_tags: list[str] = []
26class Example(KurdishBaseModel):
27 text: str
28 bold_text_offsets: list[tuple[int, int]] = []
29 translation: str = ""
30 bold_translation_offsets: list[tuple[int, int]] = []
31 roman: str = Field(
32 default="", description="Romanization of the example sentence"
33 )
34 bold_roman_offsets: list[tuple[int, int]] = []
35 ref: str = Field(
36 default="",
37 description="Source of the sentence, like book title and page number",
38 )
39 tags: list[str] = []
40 raw_tags: list[str] = []
41 sounds: list[Sound] = []
42 categories: list[str] = Field(default=[], exclude=True)
45class AltForm(KurdishBaseModel):
46 word: str
49class Sense(KurdishBaseModel):
50 glosses: list[str] = []
51 tags: list[str] = []
52 raw_tags: list[str] = []
53 categories: list[str] = []
54 examples: list[Example] = []
55 topics: list[str] = []
56 form_of: list[AltForm] = []
57 alt_of: list[AltForm] = []
60class Form(KurdishBaseModel):
61 form: str
62 tags: list[str] = []
63 raw_tags: list[str] = []
64 roman: str = ""
65 translation: str = ""
66 sense: str = ""
67 source: str = ""
70class Translation(KurdishBaseModel):
71 lang_code: str = Field(
72 description="Wiktionary language code of the translation term",
73 )
74 lang: str = Field(description="Translation language name")
75 word: str = Field(description="Translation term")
76 sense: str = Field(default="", description="Translation gloss")
77 sense_index: int = Field(
78 default=0, ge=0, description="Number of the definition, start from 1"
79 )
80 tags: list[str] = []
81 raw_tags: list[str] = []
82 roman: str = ""
83 source: str = ""
86class Linkage(KurdishBaseModel):
87 word: str
88 tags: list[str] = []
89 raw_tags: list[str] = []
90 roman: str = ""
91 translation: str = ""
92 sense: str = ""
95class Descendant(KurdishBaseModel):
96 lang_code: str = Field(description="Wiktionary language code")
97 lang: str = Field(description="Language name")
98 word: str
99 roman: str = ""
100 tags: list[str] = []
101 raw_tags: list[str] = []
102 descendants: list["Descendant"] = []
103 sense: str = ""
106class Hyphenation(KurdishBaseModel):
107 parts: list[str] = []
108 tags: list[str] = []
109 raw_tags: list[str] = []
112class WordEntry(KurdishBaseModel):
113 model_config = ConfigDict(title="Kurdish Wiktionary")
114 word: str = Field(description="Word string")
115 lang_code: str = Field(description="Wiktionary language code")
116 lang: str = Field(description="Localized language name")
117 pos: str = Field(description="Part of speech type")
118 pos_title: str = ""
119 senses: list[Sense] = []
120 categories: list[str] = []
121 tags: list[str] = []
122 raw_tags: list[str] = []
123 forms: list[Form] = []
124 etymology_text: str = ""
125 translations: list[Translation] = []
126 synonyms: list[Linkage] = []
127 antonyms: list[Linkage] = []
128 derived: list[Linkage] = []
129 related: list[Linkage] = []
130 hypernyms: list[Linkage] = []
131 hyponyms: list[Linkage] = []
132 anagrams: list[Linkage] = []
133 rhymes: list[Linkage] = []
134 sounds: list[Sound] = []
135 hyphenations: list[Hyphenation] = []
136 notes: list[str] = []
137 descendants: list[Descendant] = []
138 abbreviations: list[Linkage] = []
139 coordinate_terms: list[Linkage] = []