Coverage for src/wiktextract/extractor/cs/models.py: 100%
77 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 CzechBaseModel(BaseModel):
5 model_config = ConfigDict(
6 extra="forbid",
7 strict=True,
8 validate_assignment=True,
9 validate_default=True,
10 )
13class Example(CzechBaseModel):
14 text: str
15 bold_text_offsets: list[tuple[int, int]] = []
16 translation: str = ""
17 bold_translation_offsets: list[tuple[int, int]] = []
18 ref: str = Field(
19 default="",
20 description="Source of the sentence, like book title and page number",
21 )
24class AltForm(CzechBaseModel):
25 word: str
28class Sense(CzechBaseModel):
29 glosses: list[str] = []
30 tags: list[str] = []
31 raw_tags: list[str] = []
32 categories: list[str] = []
33 topics: list[str] = []
34 examples: list[Example] = []
35 form_of: list[AltForm] = []
38class Sound(CzechBaseModel):
39 ipa: str = Field(default="", description="International Phonetic Alphabet")
40 tags: list[str] = []
41 raw_tags: list[str] = []
42 audio: str = Field(default="", description="Audio file name")
43 wav_url: str = ""
44 oga_url: str = ""
45 ogg_url: str = ""
46 mp3_url: str = ""
47 opus_url: str = ""
48 flac_url: str = ""
49 homophone: str = ""
50 zh_pron: str = ""
51 other: str = ""
52 roman: str = ""
55class Hyphenation(CzechBaseModel):
56 parts: list[str] = []
59class Form(CzechBaseModel):
60 form: str
61 tags: list[str] = []
62 raw_tags: list[str] = []
65class Translation(CzechBaseModel):
66 lang_code: str = Field(
67 description="Wiktionary language code of the translation term",
68 )
69 lang: str = Field(description="Translation language name")
70 word: str = Field(description="Translation term")
71 sense: str = Field(default="", description="Translation gloss")
72 sense_index: int = Field(
73 default=0, ge=0, description="Number of the definition, start from 1"
74 )
75 tags: list[str] = []
76 raw_tags: list[str] = []
79class Linkage(CzechBaseModel):
80 word: str
81 tags: list[str] = []
82 raw_tags: list[str] = []
83 sense_index: int = Field(
84 default=0, ge=0, description="Number of the definition, start from 1"
85 )
88class WordEntry(CzechBaseModel):
89 model_config = ConfigDict(title="Czech Wiktionary")
90 word: str = Field(description="Word string")
91 lang_code: str = Field(description="Wiktionary language code")
92 lang: str = Field(description="Localized language name")
93 pos: str = Field(description="Part of speech type")
94 pos_title: str = ""
95 senses: list[Sense] = []
96 categories: list[str] = []
97 tags: list[str] = []
98 raw_tags: list[str] = []
99 sounds: list[Sound] = []
100 hyphenations: list[Hyphenation] = []
101 etymology_texts: list[str] = []
102 forms: list[Form] = []
103 translations: list[Translation] = []
104 synonyms: list[Linkage] = []
105 antonyms: list[Linkage] = []
106 related: list[Linkage] = []
107 phrases: list[Linkage] = []
108 proverbs: list[Linkage] = []
109 derived: list[Linkage] = []
110 note: str = ""
111 abbreviations: list[Linkage] = []