Coverage for src/wiktextract/extractor/fr/models.py: 100%
99 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 FrenchBaseModel(BaseModel):
5 model_config = ConfigDict(
6 extra="forbid",
7 strict=True,
8 validate_assignment=True,
9 validate_default=True,
10 )
13class Example(FrenchBaseModel):
14 text: str = Field(default="", description="Example usage sentence")
15 translation: str = Field(
16 default="", description="French translation of the example sentence"
17 )
18 roman: str = Field(
19 default="", description="Romanization of the example sentence"
20 )
21 ref: str = Field(
22 default="",
23 description="Source of the sentence, like book title and page number",
24 )
25 time: str = Field(
26 default="",
27 description="For examples in 'Attestations historiques' section",
28 )
31class Form(FrenchBaseModel):
32 form: str = ""
33 tags: list[str] = []
34 raw_tags: list[str] = []
35 ipas: list[str] = []
36 source: str = Field(
37 default="",
38 description="Form line template name or Conjugaison page title",
39 )
40 hiragana: str = ""
41 roman: str = ""
44class Sound(FrenchBaseModel):
45 zh_pron: str = Field(default="", description="Chinese word pronunciation")
46 ipa: str = Field(default="", description="International Phonetic Alphabet")
47 audio: str = Field(default="", description="Audio file name")
48 wav_url: str = ""
49 oga_url: str = ""
50 ogg_url: str = ""
51 mp3_url: str = ""
52 opus_url: str = ""
53 flac_url: str = ""
54 tags: list[str] = []
55 raw_tags: list[str] = []
56 rhymes: str = ""
57 categories: list[str] = Field(default=[], exclude=True)
60class Translation(FrenchBaseModel):
61 lang_code: str = Field(
62 default="",
63 description="Wiktionary language code of the translation term",
64 )
65 lang: str = Field(default="", description="Translation language name")
66 word: str = Field(default="", description="Translation term")
67 sense: str = Field(default="", description="Translation gloss")
68 sense_index: int = Field(
69 default=0, ge=0, description="Number of the definition, start from 1"
70 )
71 tags: list[str] = []
72 raw_tags: list[str] = []
73 roman: str = ""
74 traditional_writing: str = Field(
75 default="",
76 description="Alternative writting for Chinese, Korean and Mongolian",
77 )
78 ruby: list[tuple[str, ...]] = Field(
79 default=[], description="Japanese Kanji and furigana"
80 )
83class Linkage(FrenchBaseModel):
84 word: str
85 tags: list[str] = []
86 raw_tags: list[str] = []
87 topics: list[str] = []
88 roman: str = ""
89 alt: str = Field(default="", description="Alternative form")
90 translation: str = Field(default="", description="French translation")
91 sense: str = Field(default="", description="Definition of the word")
92 sense_index: int = Field(
93 default=0, ge=0, description="Number of the definition, start from 1"
94 )
95 lang: str = Field(default="", description="Localized language name")
96 lang_code: str = Field(default="", description="Wiktionary language code")
99class AltForm(FrenchBaseModel):
100 word: str
103class Sense(FrenchBaseModel):
104 glosses: list[str] = []
105 tags: list[str] = []
106 raw_tags: list[str] = []
107 topics: list[str] = []
108 categories: list[str] = []
109 examples: list[Example] = []
110 note: str = ""
111 alt_of: list[AltForm] = []
112 form_of: list[AltForm] = []
115class WordEntry(FrenchBaseModel):
116 model_config = ConfigDict(title="French Wiktionary")
118 word: str = Field(description="Word string")
119 lang_code: str = Field(description="Wiktionary language code")
120 lang: str = Field(description="Localized language name")
121 pos: str = Field(default="", description="Part of speech type")
122 pos_title: str = Field(
123 default="",
124 description="Original POS title for matching etymology texts",
125 )
126 pos_id: str = Field(
127 default="",
128 description="POS id for matching etymology texts",
129 exclude=True,
130 )
131 etymology_texts: list[str] = Field(default=[], description="Etymology list")
132 etymology_examples: list[Example] = Field(
133 default=[], description="Data in 'Attestations historiques' section"
134 )
135 senses: list[Sense] = Field(default=[], description="Sense list")
136 forms: list[Form] = Field(default=[], description="Inflection forms list")
137 sounds: list[Sound] = []
138 translations: list[Translation] = []
139 antonyms: list[Linkage] = []
140 synonyms: list[Linkage] = []
141 hyponyms: list[Linkage] = []
142 hypernyms: list[Linkage] = []
143 holonyms: list[Linkage] = []
144 meronyms: list[Linkage] = []
145 derived: list[Linkage] = []
146 troponyms: list[Linkage] = []
147 paronyms: list[Linkage] = []
148 related: list[Linkage] = []
149 abbreviation: list[Linkage] = []
150 proverbs: list[Linkage] = []
151 anagrams: list[Linkage] = []
152 title: str = Field(default="", description="Redirect page source title")
153 redirect: str = Field(default="", description="Redirect page target title")
154 categories: list[str] = []
155 notes: list[str] = []
156 tags: list[str] = []
157 raw_tags: list[str] = []