Coverage for src/wiktextract/extractor/fr/models.py: 100%
101 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 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 )
29 note: str = ""
32class Form(FrenchBaseModel):
33 form: str = ""
34 tags: list[str] = []
35 raw_tags: list[str] = []
36 ipas: list[str] = []
37 source: str = Field(
38 default="",
39 description="Form line template name or Conjugaison page title",
40 )
41 hiragana: str = ""
42 roman: str = ""
43 sense_index: int = Field(default=0, ge=0)
46class Sound(FrenchBaseModel):
47 zh_pron: str = Field(default="", description="Chinese word pronunciation")
48 ipa: str = Field(default="", description="International Phonetic Alphabet")
49 audio: str = Field(default="", description="Audio file name")
50 wav_url: str = ""
51 oga_url: str = ""
52 ogg_url: str = ""
53 mp3_url: str = ""
54 opus_url: str = ""
55 flac_url: str = ""
56 tags: list[str] = []
57 raw_tags: list[str] = []
58 rhymes: str = ""
59 categories: list[str] = Field(default=[], exclude=True)
62class Translation(FrenchBaseModel):
63 lang_code: str = Field(
64 default="",
65 description="Wiktionary language code of the translation term",
66 )
67 lang: str = Field(default="", description="Translation language name")
68 word: str = Field(default="", description="Translation term")
69 sense: str = Field(default="", description="Translation gloss")
70 sense_index: int = Field(
71 default=0, ge=0, description="Number of the definition, start from 1"
72 )
73 tags: list[str] = []
74 raw_tags: list[str] = []
75 roman: str = ""
76 traditional_writing: str = Field(
77 default="",
78 description="Alternative writting for Chinese, Korean and Mongolian",
79 )
80 ruby: list[tuple[str, ...]] = Field(
81 default=[], description="Japanese Kanji and furigana"
82 )
85class Linkage(FrenchBaseModel):
86 word: str
87 tags: list[str] = []
88 raw_tags: list[str] = []
89 topics: list[str] = []
90 roman: str = ""
91 alt: str = Field(default="", description="Alternative form")
92 translation: str = Field(default="", description="French translation")
93 sense: str = Field(default="", description="Definition of the word")
94 sense_index: int = Field(
95 default=0, ge=0, description="Number of the definition, start from 1"
96 )
97 lang: str = Field(default="", description="Localized language name")
98 lang_code: str = Field(default="", description="Wiktionary language code")
101class AltForm(FrenchBaseModel):
102 word: str
105class Sense(FrenchBaseModel):
106 glosses: list[str] = []
107 tags: list[str] = []
108 raw_tags: list[str] = []
109 topics: list[str] = []
110 categories: list[str] = []
111 examples: list[Example] = []
112 note: str = ""
113 alt_of: list[AltForm] = []
114 form_of: list[AltForm] = []
117class WordEntry(FrenchBaseModel):
118 model_config = ConfigDict(title="French Wiktionary")
120 word: str = Field(description="Word string")
121 lang_code: str = Field(description="Wiktionary language code")
122 lang: str = Field(description="Localized language name")
123 pos: str = Field(default="", description="Part of speech type")
124 pos_title: str = Field(
125 default="",
126 description="Original POS title for matching etymology texts",
127 )
128 pos_id: str = Field(
129 default="",
130 description="POS id for matching etymology texts",
131 exclude=True,
132 )
133 etymology_texts: list[str] = Field(default=[], description="Etymology list")
134 etymology_examples: list[Example] = Field(
135 default=[], description="Data in 'Attestations historiques' section"
136 )
137 senses: list[Sense] = Field(default=[], description="Sense list")
138 forms: list[Form] = Field(default=[], description="Inflection forms list")
139 sounds: list[Sound] = []
140 translations: list[Translation] = []
141 antonyms: list[Linkage] = []
142 synonyms: list[Linkage] = []
143 hyponyms: list[Linkage] = []
144 hypernyms: list[Linkage] = []
145 holonyms: list[Linkage] = []
146 meronyms: list[Linkage] = []
147 derived: list[Linkage] = []
148 troponyms: list[Linkage] = []
149 paronyms: list[Linkage] = []
150 related: list[Linkage] = []
151 abbreviation: list[Linkage] = []
152 proverbs: list[Linkage] = []
153 anagrams: list[Linkage] = []
154 title: str = Field(default="", description="Redirect page source title")
155 redirect: str = Field(default="", description="Redirect page target title")
156 categories: list[str] = []
157 notes: list[str] = []
158 tags: list[str] = []
159 raw_tags: list[str] = []