Coverage for src/wiktextract/extractor/it/models.py: 100%
82 statements
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-04 10:58 +0000
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-04 10:58 +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 bold_text_offsets: list[tuple[int, int]] = []
16 translation: str = ""
17 bold_translation_offsets: list[tuple[int, int]] = []
18 ref: str = ""
19 ruby: list[tuple[str, ...]] = Field(
20 default=[], description="Japanese Kanji and furigana"
21 )
22 roman: str = ""
23 bold_roman_offsets: list[tuple[int, int]] = []
24 tags: list[str] = []
25 raw_tags: list[str] = []
28class AltForm(ItalianBaseModel):
29 word: str
32class Sense(ItalianBaseModel):
33 glosses: list[str] = []
34 tags: list[str] = []
35 raw_tags: list[str] = []
36 categories: list[str] = []
37 examples: list[Example] = []
38 topics: list[str] = []
39 form_of: list[AltForm] = []
42class Translation(ItalianBaseModel):
43 lang_code: str = Field(
44 default="",
45 description="Wiktionary language code of the translation term",
46 )
47 lang: str = Field(default="", description="Translation language name")
48 word: str = Field(default="", description="Translation term")
49 sense: str = Field(default="", description="Translation gloss")
50 tags: list[str] = []
51 raw_tags: list[str] = []
52 roman: str = ""
55class Form(ItalianBaseModel):
56 form: str = ""
57 tags: list[str] = []
58 raw_tags: list[str] = []
59 source: str = ""
62class Sound(ItalianBaseModel):
63 ipa: str = Field(default="", description="International Phonetic Alphabet")
64 audio: str = Field(default="", description="Audio file name")
65 wav_url: str = ""
66 oga_url: str = ""
67 ogg_url: str = ""
68 mp3_url: str = ""
69 opus_url: str = ""
70 flac_url: str = ""
71 tags: list[str] = []
72 raw_tags: list[str] = []
73 sense: str = ""
76class Hyphenation(ItalianBaseModel):
77 hyphenation: str = ""
78 sense: str = ""
81class Linkage(ItalianBaseModel):
82 word: str
83 tags: list[str] = []
84 raw_tags: list[str] = []
85 sense: str = ""
88class WordEntry(ItalianBaseModel):
89 model_config = ConfigDict(title="Italian Wiktionary")
90 word: str = Field(description="Word string", min_length=1)
91 lang_code: str = Field(description="Wiktionary language code", min_length=1)
92 lang: str = Field(description="Localized language name", min_length=1)
93 pos: str = Field(description="Part of speech type", min_length=1)
94 pos_title: str = ""
95 senses: list[Sense] = []
96 categories: list[str] = []
97 tags: list[str] = []
98 raw_tags: list[str] = []
99 translations: list[Translation] = []
100 forms: list[Form] = []
101 etymology_texts: list[str] = []
102 etymology_examples: list[Example] = []
103 hyphenations: list[Hyphenation] = []
104 sounds: list[Sound] = []
105 synonyms: list[Linkage] = []
106 antonyms: list[Linkage] = []
107 derived: list[Linkage] = []
108 related: list[Linkage] = []
109 hyponyms: list[Linkage] = []
110 hypernyms: list[Linkage] = []
111 proverbs: list[Linkage] = []
112 notes: list[str] = []