Coverage for src / wiktextract / extractor / ja / models.py: 100%
117 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-12 08:09 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-12 08:09 +0000
1from pydantic import BaseModel, ConfigDict, Field
4class JapaneseBaseModel(BaseModel):
5 model_config = ConfigDict(
6 extra="forbid",
7 strict=True,
8 validate_assignment=True,
9 validate_default=True,
10 )
13class Example(JapaneseBaseModel):
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, ...]] = []
20 roman: str = ""
21 bold_roman_offsets: list[tuple[int, int]] = []
24class AltForm(JapaneseBaseModel):
25 word: str
28class Sense(JapaneseBaseModel):
29 glosses: list[str] = []
30 tags: list[str] = []
31 raw_tags: list[str] = []
32 topics: list[str] = []
33 categories: list[str] = []
34 ruby: list[tuple[str, ...]] = []
35 examples: list[Example] = []
36 form_of: list[AltForm] = []
37 notes: list[str] = []
40class Form(JapaneseBaseModel):
41 form: str = ""
42 tags: list[str] = []
43 raw_tags: list[str] = []
44 roman: str = ""
45 literal_meaning: str = ""
46 ruby: list[tuple[str, ...]] = []
49class Sound(JapaneseBaseModel):
50 zh_pron: str = Field(default="", description="Chinese word pronunciation")
51 ipa: str = Field(default="", description="International Phonetic Alphabet")
52 audio: str = Field(default="", description="Audio file name")
53 wav_url: str = ""
54 oga_url: str = ""
55 ogg_url: str = ""
56 mp3_url: str = ""
57 opus_url: str = ""
58 flac_url: str = ""
59 tags: list[str] = []
60 raw_tags: list[str] = []
61 homophones: list[str] = []
62 other: str = ""
63 roman: str = ""
64 sense: str = ""
65 rhymes: str = ""
68class Translation(JapaneseBaseModel):
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 tags: list[str] = []
77 raw_tags: list[str] = []
78 roman: str = ""
81class Linkage(JapaneseBaseModel):
82 word: str
83 tags: list[str] = []
84 raw_tags: list[str] = []
85 ruby: list[tuple[str, ...]] = []
86 sense: str = ""
87 roman: str = ""
88 literal_meaning: str = ""
91class Descendant(JapaneseBaseModel):
92 lang_code: str = Field(default="", description="Wiktionary language code")
93 lang: str = Field(default="", description="Language name")
94 word: str = ""
95 roman: str = ""
96 descendants: list["Descendant"] = []
97 sense: str = ""
98 tags: list[str] = []
99 raw_tags: list[str] = []
102class Hyphenation(JapaneseBaseModel):
103 parts: list[str] = []
106class Classifier(JapaneseBaseModel):
107 classifier: str = ""
108 tags: list[str] = []
109 raw_tags: list[str] = []
112class WordEntry(JapaneseBaseModel):
113 model_config = ConfigDict(title="Japanese Wiktionary")
115 word: str = Field(description="Word string")
116 lang_code: str = Field(description="Wiktionary language code")
117 lang: str = Field(description="Localized language name")
118 pos: str = Field(default="", description="Part of speech type")
119 pos_title: str = ""
120 senses: list[Sense] = []
121 title: str = Field(default="", description="Redirect page source title")
122 redirect: str = Field(default="", description="Redirect page target title")
123 categories: list[str] = []
124 tags: list[str] = []
125 raw_tags: list[str] = []
126 forms: list[Form] = []
127 etymology_texts: list[str] = []
128 sounds: list[Sound] = []
129 translations: list[Translation] = []
130 antonyms: list[Linkage] = []
131 synonyms: list[Linkage] = []
132 hyponyms: list[Linkage] = []
133 hypernyms: list[Linkage] = []
134 holonyms: list[Linkage] = []
135 meronyms: list[Linkage] = []
136 derived: list[Linkage] = []
137 contraction: list[Linkage] = []
138 abbreviations: list[Linkage] = []
139 related: list[Linkage] = []
140 collocations: list[Linkage] = []
141 proverbs: list[Linkage] = []
142 phrases: list[Linkage] = []
143 coordinate_terms: list[Linkage] = []
144 cognates: list[Descendant] = []
145 descendants: list[Descendant] = []
146 anagrams: list[Linkage] = []
147 notes: list[str] = []
148 proverbs: list[Descendant] = []
149 hyphenations: list[Hyphenation] = []
150 classifiers: list[Classifier] = []