Coverage for src/wiktextract/extractor/nl/models.py: 100%
92 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-25 10:11 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-25 10:11 +0000
1from pydantic import BaseModel, ConfigDict, Field
4class DutchBaseModel(BaseModel):
5 model_config = ConfigDict(
6 extra="forbid",
7 strict=True,
8 validate_assignment=True,
9 validate_default=True,
10 )
13class Example(DutchBaseModel):
14 text: str = ""
15 translation: str = ""
16 ref: str = ""
19class AltForm(DutchBaseModel):
20 word: str
23class Sense(DutchBaseModel):
24 glosses: list[str] = []
25 tags: list[str] = []
26 raw_tags: list[str] = []
27 categories: list[str] = []
28 examples: list[Example] = []
29 form_of: list[AltForm] = []
30 topics: list[str] = []
33class Sound(DutchBaseModel):
34 ipa: str = Field(default="", description="International Phonetic Alphabet")
35 audio: str = Field(default="", description="Audio file name")
36 wav_url: str = ""
37 oga_url: str = ""
38 ogg_url: str = ""
39 mp3_url: str = ""
40 opus_url: str = ""
41 flac_url: str = ""
42 tags: list[str] = []
43 raw_tags: list[str] = []
46class Linkage(DutchBaseModel):
47 word: str
48 tags: list[str] = []
49 raw_tags: list[str] = []
50 roman: str = ""
51 sense: str = Field(default="", description="Definition of the word")
52 sense_index: int = Field(
53 default=0, ge=0, description="Number of the definition, start from 1"
54 )
57class Translation(DutchBaseModel):
58 lang_code: str = Field(
59 default="",
60 description="Wiktionary language code of the translation term",
61 )
62 lang: str = Field(default="", description="Translation language name")
63 word: str = Field(default="", description="Translation term")
64 sense: str = Field(default="", description="Translation gloss")
65 sense_index: int = Field(
66 default=0, ge=0, description="Number of the definition, start from 1"
67 )
68 tags: list[str] = []
69 raw_tags: list[str] = []
70 roman: str = ""
73class Etymology(DutchBaseModel):
74 text: str = ""
75 categories: list[str] = []
76 index: str = ""
79class Form(DutchBaseModel):
80 form: str = ""
81 note: str = ""
82 tags: list[str] = []
83 raw_tags: list[str] = []
84 ipa: str = ""
85 source: str = ""
88class Descendant(DutchBaseModel):
89 lang_code: str
90 lang: str
91 word: str
92 descendants: list["Descendant"] = []
95class WordEntry(DutchBaseModel):
96 model_config = ConfigDict(title="Dutch Wiktionary")
97 word: str = Field(description="Word string", min_length=1)
98 lang_code: str = Field(description="Wiktionary language code", min_length=1)
99 lang: str = Field(description="Localized language name", min_length=1)
100 pos: str = Field(description="Part of speech type", min_length=1)
101 pos_title: str = ""
102 senses: list[Sense] = []
103 categories: list[str] = []
104 tags: list[str] = []
105 raw_tags: list[str] = []
106 etymology_index: str = Field(default="", exclude=True)
107 etymology_texts: list[str] = []
108 sounds: list[Sound] = []
109 anagrams: list[Linkage] = []
110 antonyms: list[Linkage] = []
111 derived: list[Linkage] = []
112 proverbs: list[Linkage] = []
113 holonyms: list[Linkage] = []
114 homophones: list[Linkage] = []
115 hypernyms: list[Linkage] = []
116 hyponyms: list[Linkage] = []
117 metonyms: list[Linkage] = []
118 paronyms: list[Linkage] = []
119 related: list[Linkage] = []
120 rhymes: list[Linkage] = []
121 synonyms: list[Linkage] = []
122 translations: list[Translation] = []
123 hyphenation: str = ""
124 forms: list[Form] = []
125 notes: list[str] = []
126 descendants: list[Descendant] = []