Coverage for src / wiktextract / extractor / cs / models.py: 100%
78 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 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] = []
63 roman: str = ""
66class Translation(CzechBaseModel):
67 lang_code: str = Field(
68 description="Wiktionary language code of the translation term",
69 )
70 lang: str = Field(description="Translation language name")
71 word: str = Field(description="Translation term")
72 sense: str = Field(default="", description="Translation gloss")
73 sense_index: int = Field(
74 default=0, ge=0, description="Number of the definition, start from 1"
75 )
76 tags: list[str] = []
77 raw_tags: list[str] = []
80class Linkage(CzechBaseModel):
81 word: str
82 tags: list[str] = []
83 raw_tags: list[str] = []
84 sense_index: int = Field(
85 default=0, ge=0, description="Number of the definition, start from 1"
86 )
89class WordEntry(CzechBaseModel):
90 model_config = ConfigDict(title="Czech Wiktionary")
91 word: str = Field(description="Word string")
92 lang_code: str = Field(description="Wiktionary language code")
93 lang: str = Field(description="Localized language name")
94 pos: str = Field(description="Part of speech type")
95 pos_title: str = ""
96 senses: list[Sense] = []
97 categories: list[str] = []
98 tags: list[str] = []
99 raw_tags: list[str] = []
100 sounds: list[Sound] = []
101 hyphenations: list[Hyphenation] = []
102 etymology_texts: list[str] = []
103 forms: list[Form] = []
104 translations: list[Translation] = []
105 synonyms: list[Linkage] = []
106 antonyms: list[Linkage] = []
107 related: list[Linkage] = []
108 phrases: list[Linkage] = []
109 proverbs: list[Linkage] = []
110 derived: list[Linkage] = []
111 note: str = ""
112 abbreviations: list[Linkage] = []