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

95 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2024-12-27 08:07 +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 translation: str = "" 

16 ref: str = "" 

17 

18 

19class AltForm(DutchBaseModel): 

20 word: str 

21 

22 

23class Sense(DutchBaseModel): 

24 glosses: list[str] = [] 

25 tags: list[str] = [] 

26 raw_tags: list[str] = [] 

27 categories: list[str] = [] 

28 examples: list[Example] = [] 

29 form_of: list[AltForm] = [] 

30 topics: list[str] = [] 

31 

32 

33class Sound(DutchBaseModel): 

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

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

36 wav_url: str = "" 

37 oga_url: str = "" 

38 ogg_url: str = "" 

39 mp3_url: str = "" 

40 opus_url: str = "" 

41 flac_url: str = "" 

42 tags: list[str] = [] 

43 raw_tags: list[str] = [] 

44 

45 

46class Linkage(DutchBaseModel): 

47 word: str 

48 tags: list[str] = [] 

49 raw_tags: list[str] = [] 

50 roman: str = "" 

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

52 sense_index: int = Field( 

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

54 ) 

55 

56 

57class Translation(DutchBaseModel): 

58 lang_code: str = Field( 

59 default="", 

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

61 ) 

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

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

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

65 sense_index: int = Field( 

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

67 ) 

68 tags: list[str] = [] 

69 raw_tags: list[str] = [] 

70 roman: str = "" 

71 

72 

73class Etymology(DutchBaseModel): 

74 text: str = "" 

75 categories: list[str] = [] 

76 index: str = "" 

77 

78 

79class Form(DutchBaseModel): 

80 form: str = "" 

81 note: str = "" 

82 tags: list[str] = [] 

83 raw_tags: list[str] = [] 

84 ipa: str = "" 

85 source: str = "" 

86 sense: str = "" 

87 

88 

89class Descendant(DutchBaseModel): 

90 lang_code: str 

91 lang: str 

92 word: str 

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

94 

95 

96class WordEntry(DutchBaseModel): 

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

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

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

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

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

102 pos_title: str = "" 

103 senses: list[Sense] = [] 

104 categories: list[str] = [] 

105 tags: list[str] = [] 

106 raw_tags: list[str] = [] 

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

108 etymology_texts: list[str] = [] 

109 sounds: list[Sound] = [] 

110 abbreviations: list[Linkage] = [] 

111 anagrams: list[Linkage] = [] 

112 antonyms: list[Linkage] = [] 

113 derived: list[Linkage] = [] 

114 proverbs: list[Linkage] = [] 

115 holonyms: list[Linkage] = [] 

116 homophones: list[Linkage] = [] 

117 hypernyms: list[Linkage] = [] 

118 hyponyms: list[Linkage] = [] 

119 metonyms: list[Linkage] = [] 

120 paronyms: list[Linkage] = [] 

121 related: list[Linkage] = [] 

122 rhymes: list[Linkage] = [] 

123 synonyms: list[Linkage] = [] 

124 translations: list[Translation] = [] 

125 hyphenation: str = "" 

126 forms: list[Form] = [] 

127 notes: list[str] = [] 

128 descendants: list[Descendant] = [] 

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