Coverage for src/wiktextract/extractor/fr/models.py: 100%
107 statements
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-11 10:26 +0000
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-11 10:26 +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 bold_text_offsets: list[tuple[int, int]] = []
16 translation: str = Field(
17 default="", description="French translation of the example sentence"
18 )
19 bold_translation_offsets: list[tuple[int, int]] = []
20 roman: str = Field(
21 default="", description="Romanization of the example sentence"
22 )
23 bold_roman_offsets: list[tuple[int, int]] = []
24 ref: str = Field(
25 default="",
26 description="Source of the sentence, like book title and page number",
27 )
28 time: str = Field(
29 default="",
30 description="For examples in 'Attestations historiques' section",
31 )
32 note: str = ""
35class Form(FrenchBaseModel):
36 form: str = ""
37 tags: list[str] = []
38 raw_tags: list[str] = []
39 ipas: list[str] = []
40 source: str = Field(
41 default="",
42 description="Form line template name or Conjugaison page title",
43 )
44 hiragana: str = ""
45 roman: str = ""
46 sense: str = Field(default="", description="Definition of the word")
47 sense_index: int = Field(default=0, ge=0)
50class Sound(FrenchBaseModel):
51 zh_pron: str = Field(default="", description="Chinese word pronunciation")
52 ipa: str = Field(default="", description="International Phonetic Alphabet")
53 audio: str = Field(default="", description="Audio file name")
54 wav_url: str = ""
55 oga_url: str = ""
56 ogg_url: str = ""
57 mp3_url: str = ""
58 opus_url: str = ""
59 flac_url: str = ""
60 tags: list[str] = []
61 raw_tags: list[str] = []
62 rhymes: str = ""
63 categories: list[str] = Field(default=[], exclude=True)
64 homophone: str = ""
65 roman: str = ""
68class Translation(FrenchBaseModel):
69 lang_code: str = Field(
70 default="",
71 description="Wiktionary language code of the translation term",
72 )
73 lang: str = Field(default="", description="Translation language name")
74 word: str = Field(default="", description="Translation term")
75 sense: str = Field(default="", description="Translation gloss")
76 sense_index: int = Field(
77 default=0, ge=0, description="Number of the definition, start from 1"
78 )
79 tags: list[str] = []
80 raw_tags: list[str] = []
81 roman: str = ""
82 traditional_writing: str = Field(
83 default="",
84 description="Alternative writting for Chinese, Korean and Mongolian",
85 )
86 ruby: list[tuple[str, ...]] = Field(
87 default=[], description="Japanese Kanji and furigana"
88 )
91class Linkage(FrenchBaseModel):
92 word: str
93 tags: list[str] = []
94 raw_tags: list[str] = []
95 topics: list[str] = []
96 roman: str = ""
97 alt: str = Field(default="", description="Alternative form")
98 translation: str = Field(default="", description="French translation")
99 sense: str = Field(default="", description="Definition of the word")
100 sense_index: int = Field(
101 default=0, ge=0, description="Number of the definition, start from 1"
102 )
103 lang: str = Field(default="", description="Localized language name")
104 lang_code: str = Field(default="", description="Wiktionary language code")
107class AltForm(FrenchBaseModel):
108 word: str
111class Sense(FrenchBaseModel):
112 glosses: list[str] = []
113 tags: list[str] = []
114 raw_tags: list[str] = []
115 topics: list[str] = []
116 categories: list[str] = []
117 examples: list[Example] = []
118 note: str = ""
119 alt_of: list[AltForm] = []
120 form_of: list[AltForm] = []
123class WordEntry(FrenchBaseModel):
124 model_config = ConfigDict(title="French Wiktionary")
126 word: str = Field(description="Word string")
127 lang_code: str = Field(description="Wiktionary language code")
128 lang: str = Field(description="Localized language name")
129 pos: str = Field(default="", description="Part of speech type")
130 pos_title: str = Field(
131 default="",
132 description="Original POS title for matching etymology texts",
133 )
134 pos_id: str = Field(
135 default="",
136 description="POS id for matching etymology texts",
137 exclude=True,
138 )
139 etymology_texts: list[str] = Field(default=[], description="Etymology list")
140 etymology_examples: list[Example] = Field(
141 default=[], description="Data in 'Attestations historiques' section"
142 )
143 senses: list[Sense] = Field(default=[], description="Sense list")
144 forms: list[Form] = Field(default=[], description="Inflection forms list")
145 sounds: list[Sound] = []
146 translations: list[Translation] = []
147 antonyms: list[Linkage] = []
148 synonyms: list[Linkage] = []
149 hyponyms: list[Linkage] = []
150 hypernyms: list[Linkage] = []
151 holonyms: list[Linkage] = []
152 meronyms: list[Linkage] = []
153 derived: list[Linkage] = []
154 troponyms: list[Linkage] = []
155 paronyms: list[Linkage] = []
156 related: list[Linkage] = []
157 abbreviation: list[Linkage] = []
158 proverbs: list[Linkage] = []
159 anagrams: list[Linkage] = []
160 title: str = Field(default="", description="Redirect page source title")
161 redirect: str = Field(default="", description="Redirect page target title")
162 categories: list[str] = []
163 notes: list[str] = []
164 tags: list[str] = []
165 raw_tags: list[str] = []