Coverage for src/wiktextract/extractor/it/models.py: 100%
75 statements
« prev ^ index » next coverage.py v7.6.10, created at 2024-12-27 08:07 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2024-12-27 08:07 +0000
1from pydantic import BaseModel, ConfigDict, Field
4class ItalianBaseModel(BaseModel):
5 model_config = ConfigDict(
6 extra="forbid",
7 strict=True,
8 validate_assignment=True,
9 validate_default=True,
10 )
13class Example(ItalianBaseModel):
14 text: str = ""
15 translation: str = ""
16 ref: str = ""
17 ruby: list[tuple[str, ...]] = Field(
18 default=[], description="Japanese Kanji and furigana"
19 )
20 roman: str = ""
21 tags: list[str] = []
22 raw_tags: list[str] = []
25class Sense(ItalianBaseModel):
26 glosses: list[str] = []
27 tags: list[str] = []
28 raw_tags: list[str] = []
29 categories: list[str] = []
30 examples: list[Example] = []
31 topics: list[str] = []
34class Translation(ItalianBaseModel):
35 lang_code: str = Field(
36 default="",
37 description="Wiktionary language code of the translation term",
38 )
39 lang: str = Field(default="", description="Translation language name")
40 word: str = Field(default="", description="Translation term")
41 sense: str = Field(default="", description="Translation gloss")
42 tags: list[str] = []
43 raw_tags: list[str] = []
44 roman: str = ""
47class Form(ItalianBaseModel):
48 form: str = ""
49 tags: list[str] = []
50 raw_tags: list[str] = []
51 source: str = ""
54class Sound(ItalianBaseModel):
55 ipa: str = Field(default="", description="International Phonetic Alphabet")
56 audio: str = Field(default="", description="Audio file name")
57 wav_url: str = ""
58 oga_url: str = ""
59 ogg_url: str = ""
60 mp3_url: str = ""
61 opus_url: str = ""
62 flac_url: str = ""
63 tags: list[str] = []
64 raw_tags: list[str] = []
65 sense: str = ""
68class Hyphenation(ItalianBaseModel):
69 hyphenation: str = ""
70 sense: str = ""
73class Linkage(ItalianBaseModel):
74 word: str
75 tags: list[str] = []
76 raw_tags: list[str] = []
77 sense: str = ""
80class WordEntry(ItalianBaseModel):
81 model_config = ConfigDict(title="Italian Wiktionary")
82 word: str = Field(description="Word string", min_length=1)
83 lang_code: str = Field(description="Wiktionary language code", min_length=1)
84 lang: str = Field(description="Localized language name", min_length=1)
85 pos: str = Field(description="Part of speech type", min_length=1)
86 pos_title: str = ""
87 senses: list[Sense] = []
88 categories: list[str] = []
89 tags: list[str] = []
90 raw_tags: list[str] = []
91 translations: list[Translation] = []
92 forms: list[Form] = []
93 etymology_texts: list[str] = []
94 etymology_examples: list[Example] = []
95 hyphenations: list[Hyphenation] = []
96 sounds: list[Sound] = []
97 synonyms: list[Linkage] = []
98 antonyms: list[Linkage] = []
99 derived: list[Linkage] = []
100 related: list[Linkage] = []
101 hyponyms: list[Linkage] = []
102 hypernyms: list[Linkage] = []
103 proverbs: list[Linkage] = []