Coverage for src/wiktextract/extractor/ja/models.py: 100%
94 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 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 translation: str = ""
16 ref: str = ""
17 ruby: list[tuple[str, ...]] = []
20class AltForm(JapaneseBaseModel):
21 word: str
24class Sense(JapaneseBaseModel):
25 glosses: list[str] = []
26 tags: list[str] = []
27 raw_tags: list[str] = []
28 topics: list[str] = []
29 categories: list[str] = []
30 ruby: list[tuple[str, ...]] = []
31 examples: list[Example] = []
32 form_of: list[AltForm] = []
35class Form(JapaneseBaseModel):
36 form: str = ""
37 tags: list[str] = []
38 raw_tags: list[str] = []
41class Sound(JapaneseBaseModel):
42 zh_pron: str = Field(default="", description="Chinese word pronunciation")
43 ipa: str = Field(default="", description="International Phonetic Alphabet")
44 audio: str = Field(default="", description="Audio file name")
45 wav_url: str = ""
46 oga_url: str = ""
47 ogg_url: str = ""
48 mp3_url: str = ""
49 opus_url: str = ""
50 flac_url: str = ""
51 tags: list[str] = []
52 raw_tags: list[str] = []
53 homophones: list[str] = []
54 form: str = ""
55 roman: str = ""
58class Translation(JapaneseBaseModel):
59 lang_code: str = Field(
60 default="",
61 description="Wiktionary language code of the translation term",
62 )
63 lang: str = Field(default="", description="Translation language name")
64 word: str = Field(default="", description="Translation term")
65 sense: str = Field(default="", description="Translation gloss")
66 tags: list[str] = []
67 raw_tags: list[str] = []
68 roman: str = ""
71class Linkage(JapaneseBaseModel):
72 word: str
73 tags: list[str] = []
74 raw_tags: list[str] = []
75 ruby: list[tuple[str, ...]] = []
76 sense: str = ""
79class Descendant(JapaneseBaseModel):
80 lang_code: str = Field(default="", description="Wiktionary language code")
81 lang: str = Field(default="", description="Language name")
82 word: str = ""
83 roman: str = ""
84 descendants: list["Descendant"] = []
85 sense: str = ""
86 tags: list[str] = []
87 raw_tags: list[str] = []
90class WordEntry(JapaneseBaseModel):
91 model_config = ConfigDict(title="Japanese Wiktionary")
93 word: str = Field(description="Word string")
94 lang_code: str = Field(description="Wiktionary language code")
95 lang: str = Field(description="Localized language name")
96 pos: str = Field(default="", description="Part of speech type")
97 pos_title: str = ""
98 senses: list[Sense] = []
99 title: str = Field(default="", description="Redirect page source title")
100 redirect: str = Field(default="", description="Redirect page target title")
101 categories: list[str] = []
102 tags: list[str] = []
103 raw_tags: list[str] = []
104 forms: list[Form] = []
105 etymology_texts: list[str] = []
106 sounds: list[Sound] = []
107 translations: list[Translation] = []
108 antonyms: list[Linkage] = []
109 synonyms: list[Linkage] = []
110 hyponyms: list[Linkage] = []
111 hypernyms: list[Linkage] = []
112 holonyms: list[Linkage] = []
113 meronyms: list[Linkage] = []
114 derived: list[Linkage] = []
115 contraction: list[Linkage] = []
116 abbreviations: list[Linkage] = []
117 related: list[Linkage] = []
118 collocations: list[Linkage] = []
119 proverbs: list[Linkage] = []
120 phrases: list[Linkage] = []
121 coordinate_terms: list[Linkage] = []
122 cognates: list[Descendant] = []
123 descendants: list[Descendant] = []