Coverage for src/wiktextract/extractor/id/models.py: 100%

89 statements  

« prev     ^ index     » next       coverage.py v7.10.3, created at 2025-08-15 05:18 +0000

1from pydantic import BaseModel, ConfigDict, Field 

2 

3 

4class IndonesianBaseModel(BaseModel): 

5 model_config = ConfigDict( 

6 extra="forbid", 

7 strict=True, 

8 validate_assignment=True, 

9 validate_default=True, 

10 ) 

11 

12 

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] = [] 

25 

26 

27class AltForm(IndonesianBaseModel): 

28 word: str 

29 

30 

31class Attestation(IndonesianBaseModel): 

32 date: str 

33 

34 

35class Sense(IndonesianBaseModel): 

36 glosses: list[str] = [] 

37 tags: list[str] = [] 

38 raw_tags: list[str] = [] 

39 categories: list[str] = [] 

40 examples: list[Example] = [] 

41 topics: list[str] = [] 

42 alt_of: list[AltForm] = [] 

43 form_of: list[AltForm] = [] 

44 attestations: list[Attestation] = [] 

45 

46 

47class Translation(IndonesianBaseModel): 

48 lang_code: str = Field( 

49 description="Wiktionary language code of the translation term", 

50 ) 

51 lang: str = Field(description="Translation language name") 

52 word: str = Field(description="Translation term") 

53 sense: str = Field(default="", description="Translation gloss") 

54 tags: list[str] = [] 

55 raw_tags: list[str] = [] 

56 roman: str = "" 

57 lit: str = Field(default="", description="Literal translation") 

58 

59 

60class Sound(IndonesianBaseModel): 

61 zh_pron: str = Field(default="", description="Chinese word pronunciation") 

62 ipa: str = Field(default="", description="International Phonetic Alphabet") 

63 audio: str = Field(default="", description="Audio file name") 

64 wav_url: str = "" 

65 oga_url: str = "" 

66 ogg_url: str = "" 

67 mp3_url: str = "" 

68 opus_url: str = "" 

69 flac_url: str = "" 

70 tags: list[str] = [] 

71 raw_tags: list[str] = [] 

72 roman: str = "" 

73 rhymes: str = "" 

74 

75 

76class Linkage(IndonesianBaseModel): 

77 word: str 

78 tags: list[str] = [] 

79 raw_tags: list[str] = [] 

80 roman: str = "" 

81 source: str = "" 

82 sense: str = "" 

83 

84 

85class Form(IndonesianBaseModel): 

86 form: str 

87 tags: list[str] = [] 

88 raw_tags: list[str] = [] 

89 

90 

91class Hyphenation(IndonesianBaseModel): 

92 parts: list[str] = [] 

93 tags: list[str] = [] 

94 raw_tags: list[str] = [] 

95 

96 

97class WordEntry(IndonesianBaseModel): 

98 model_config = ConfigDict(title="Indonesian Wiktionary") 

99 word: str = Field(description="Word string") 

100 lang_code: str = Field(description="Wiktionary language code") 

101 lang: str = Field(description="Localized language name") 

102 pos: str = Field(description="Part of speech type") 

103 pos_title: str = "" 

104 senses: list[Sense] = [] 

105 categories: list[str] = [] 

106 tags: list[str] = [] 

107 raw_tags: list[str] = [] 

108 etymology_texts: list[str] = [] 

109 translations: list[Translation] = [] 

110 sounds: list[Sound] = [] 

111 antonyms: list[Linkage] = [] 

112 synonyms: list[Linkage] = [] 

113 forms: list[Form] = [] 

114 derived: list[Linkage] = [] 

115 related: list[Linkage] = [] 

116 proverbs: list[Linkage] = [] 

117 notes: list[str] = [] 

118 hyphenations: list[Hyphenation] = []