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

101 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 DutchBaseModel(BaseModel): 

5 model_config = ConfigDict( 

6 extra="forbid", 

7 strict=True, 

8 validate_assignment=True, 

9 validate_default=True, 

10 ) 

11 

12 

13class Example(DutchBaseModel): 

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 

20 

21class AltForm(DutchBaseModel): 

22 word: str 

23 

24 

25class Sense(DutchBaseModel): 

26 glosses: list[str] = [] 

27 tags: list[str] = [] 

28 raw_tags: list[str] = [] 

29 categories: list[str] = [] 

30 examples: list[Example] = [] 

31 form_of: list[AltForm] = [] 

32 topics: list[str] = [] 

33 

34 

35class Sound(DutchBaseModel): 

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

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

38 wav_url: str = "" 

39 oga_url: str = "" 

40 ogg_url: str = "" 

41 mp3_url: str = "" 

42 opus_url: str = "" 

43 flac_url: str = "" 

44 tags: list[str] = [] 

45 raw_tags: list[str] = [] 

46 

47 

48class Linkage(DutchBaseModel): 

49 word: str 

50 tags: list[str] = [] 

51 raw_tags: list[str] = [] 

52 roman: str = "" 

53 sense: str = Field(default="", description="Definition of the word") 

54 sense_index: int = Field( 

55 default=0, ge=0, description="Number of the definition, start from 1" 

56 ) 

57 

58 

59class Translation(DutchBaseModel): 

60 lang_code: str = Field( 

61 default="", 

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

63 ) 

64 lang: str = Field(default="", description="Translation language name") 

65 word: str = Field(default="", description="Translation term") 

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

67 sense_index: int = Field( 

68 default=0, ge=0, description="Number of the definition, start from 1" 

69 ) 

70 tags: list[str] = [] 

71 raw_tags: list[str] = [] 

72 roman: str = "" 

73 

74 

75class Etymology(DutchBaseModel): 

76 text: str = "" 

77 categories: list[str] = [] 

78 index: str = "" 

79 

80 

81class Form(DutchBaseModel): 

82 form: str = "" 

83 note: str = "" 

84 tags: list[str] = [] 

85 raw_tags: list[str] = [] 

86 ipa: str = "" 

87 source: str = "" 

88 sense: str = "" 

89 

90 

91class Descendant(DutchBaseModel): 

92 lang_code: str 

93 lang: str 

94 word: str 

95 descendants: list["Descendant"] = [] 

96 

97 

98class Hyphenation(DutchBaseModel): 

99 parts: list[str] = [] 

100 tags: list[str] = [] 

101 raw_tags: list[str] = [] 

102 

103 

104class WordEntry(DutchBaseModel): 

105 model_config = ConfigDict(title="Dutch Wiktionary") 

106 word: str = Field(description="Word string", min_length=1) 

107 lang_code: str = Field(description="Wiktionary language code", min_length=1) 

108 lang: str = Field(description="Localized language name", min_length=1) 

109 pos: str = Field(description="Part of speech type", min_length=1) 

110 pos_title: str = "" 

111 senses: list[Sense] = [] 

112 categories: list[str] = [] 

113 tags: list[str] = [] 

114 raw_tags: list[str] = [] 

115 etymology_index: str = Field(default="", exclude=True) 

116 etymology_texts: list[str] = [] 

117 sounds: list[Sound] = [] 

118 abbreviations: list[Linkage] = [] 

119 anagrams: list[Linkage] = [] 

120 antonyms: list[Linkage] = [] 

121 derived: list[Linkage] = [] 

122 proverbs: list[Linkage] = [] 

123 holonyms: list[Linkage] = [] 

124 homophones: list[Linkage] = [] 

125 hypernyms: list[Linkage] = [] 

126 hyponyms: list[Linkage] = [] 

127 metonyms: list[Linkage] = [] 

128 paronyms: list[Linkage] = [] 

129 related: list[Linkage] = [] 

130 rhymes: list[Linkage] = [] 

131 synonyms: list[Linkage] = [] 

132 translations: list[Translation] = [] 

133 hyphenations: list[Hyphenation] = [] 

134 forms: list[Form] = [] 

135 notes: list[str] = [] 

136 descendants: list[Descendant] = [] 

137 extracted_vervoeging_page: bool = Field(default=False, exclude=True)