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

95 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 PolishBaseModel(BaseModel): 

5 model_config = ConfigDict( 

6 extra="forbid", 

7 strict=True, 

8 validate_assignment=True, 

9 validate_default=True, 

10 ) 

11 

12 

13class Example(PolishBaseModel): 

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 roman: str = "" 

20 literal_meaning: str = "" 

21 

22 

23class AltForm(PolishBaseModel): 

24 word: str 

25 

26 

27class Attestation(PolishBaseModel): 

28 date: str 

29 

30 

31class Sense(PolishBaseModel): 

32 glosses: list[str] = [] 

33 tags: list[str] = [] 

34 raw_tags: list[str] = [] 

35 topics: list[str] = [] 

36 categories: list[str] = [] 

37 sense_index: str = "" 

38 examples: list[Example] = [] 

39 alt_of: list[AltForm] = [] 

40 form_of: list[AltForm] = [] 

41 notes: list[str] = [] 

42 attestations: list[Attestation] = [] 

43 

44 

45class Translation(PolishBaseModel): 

46 lang_code: str = "" 

47 lang: str = "" 

48 word: str = "" 

49 sense_index: str = "" 

50 tags: list[str] = [] 

51 raw_tags: list[str] = [] 

52 roman: str = "" 

53 ruby: list[tuple[str, ...]] = [] 

54 

55 

56class Sound(PolishBaseModel): 

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

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

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

60 wav_url: str = "" 

61 oga_url: str = "" 

62 ogg_url: str = "" 

63 mp3_url: str = "" 

64 opus_url: str = "" 

65 flac_url: str = "" 

66 tags: list[str] = [] 

67 raw_tags: list[str] = [] 

68 

69 

70class Linkage(PolishBaseModel): 

71 word: str 

72 tags: list[str] = [] 

73 raw_tags: list[str] = [] 

74 sense_index: str = "" 

75 topics: list[str] = [] 

76 furigana: str = "" 

77 translation: str = "" 

78 

79 

80class Form(PolishBaseModel): 

81 form: str = "" 

82 tags: list[str] = [] 

83 raw_tags: list[str] = [] 

84 sense_index: str = "" 

85 

86 

87class Note(PolishBaseModel): 

88 sense_index: str = "" 

89 text: str = Field(min_length=1) 

90 

91 

92class Hyphenation(PolishBaseModel): 

93 parts: list[str] = [] 

94 tags: list[str] = [] 

95 raw_tags: list[str] = [] 

96 

97 

98class WordEntry(PolishBaseModel): 

99 model_config = ConfigDict(title="Polish Wiktionary") 

100 

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

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

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

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

105 pos_text: str = "" 

106 senses: list[Sense] = [] 

107 title: str = Field(default="", description="Redirect page source title") 

108 redirect: str = Field(default="", description="Redirect page target title") 

109 categories: list[str] = [] 

110 tags: list[str] = [] 

111 raw_tags: list[str] = [] 

112 etymology_texts: list[str] = [] 

113 translations: list[Translation] = [] 

114 sounds: list[Sound] = [] 

115 antonyms: list[Linkage] = [] 

116 hypernyms: list[Linkage] = [] 

117 hyponyms: list[Linkage] = [] 

118 holonyms: list[Linkage] = [] 

119 meronyms: list[Linkage] = [] 

120 related: list[Linkage] = [] 

121 proverbs: list[Linkage] = [] 

122 synonyms: list[Linkage] = [] 

123 derived: list[Linkage] = [] 

124 forms: list[Form] = [] 

125 hyphenations: list[Hyphenation] = []