Coverage for src/wiktextract/extractor/id/models.py: 100%
82 statements
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-04 10:58 +0000
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-04 10:58 +0000
1from pydantic import BaseModel, ConfigDict, Field
4class IndonesianBaseModel(BaseModel):
5 model_config = ConfigDict(
6 extra="forbid",
7 strict=True,
8 validate_assignment=True,
9 validate_default=True,
10 )
13class Example(IndonesianBaseModel):
14 text: str
15 bold_text_offsets: list[tuple[int, int]] = []
16 translation: str = ""
17 bold_translation_offsets: list[tuple[int, int]] = []
18 literal_meaning: str = ""
19 bold_literal_offsets: list[tuple[int, int]] = []
20 roman: str = ""
21 bold_roman_offsets: list[tuple[int, int]] = []
22 ref: str = ""
23 tags: list[str] = []
24 raw_tags: list[str] = []
27class AltForm(IndonesianBaseModel):
28 word: str
31class Sense(IndonesianBaseModel):
32 glosses: list[str] = []
33 tags: list[str] = []
34 raw_tags: list[str] = []
35 categories: list[str] = []
36 examples: list[Example] = []
37 topics: list[str] = []
38 alt_of: list[AltForm] = []
39 form_of: list[AltForm] = []
42class Translation(IndonesianBaseModel):
43 lang_code: str = Field(
44 description="Wiktionary language code of the translation term",
45 )
46 lang: str = Field(description="Translation language name")
47 word: str = Field(description="Translation term")
48 sense: str = Field(default="", description="Translation gloss")
49 tags: list[str] = []
50 raw_tags: list[str] = []
51 roman: str = ""
52 lit: str = Field(default="", description="Literal translation")
55class Sound(IndonesianBaseModel):
56 zh_pron: str = Field(default="", description="Chinese word pronunciation")
57 ipa: str = Field(default="", description="International Phonetic Alphabet")
58 audio: str = Field(default="", description="Audio file name")
59 wav_url: str = ""
60 oga_url: str = ""
61 ogg_url: str = ""
62 mp3_url: str = ""
63 opus_url: str = ""
64 flac_url: str = ""
65 tags: list[str] = []
66 raw_tags: list[str] = []
67 roman: str = ""
68 rhymes: str = ""
71class Linkage(IndonesianBaseModel):
72 word: str
73 tags: list[str] = []
74 raw_tags: list[str] = []
75 roman: str = ""
76 source: str = ""
77 sense: str = ""
80class Form(IndonesianBaseModel):
81 form: str
82 tags: list[str] = []
83 raw_tags: list[str] = []
86class WordEntry(IndonesianBaseModel):
87 model_config = ConfigDict(title="Indonesian Wiktionary")
88 word: str = Field(description="Word string")
89 lang_code: str = Field(description="Wiktionary language code")
90 lang: str = Field(description="Localized language name")
91 pos: str = Field(description="Part of speech type")
92 pos_title: str = ""
93 senses: list[Sense] = []
94 categories: list[str] = []
95 tags: list[str] = []
96 raw_tags: list[str] = []
97 etymology_texts: list[str] = []
98 translations: list[Translation] = []
99 sounds: list[Sound] = []
100 antonyms: list[Linkage] = []
101 synonyms: list[Linkage] = []
102 forms: list[Form] = []
103 derived: list[Linkage] = []
104 related: list[Linkage] = []
105 proverbs: list[Linkage] = []
106 notes: list[str] = []
107 hyphenation: str = ""