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

88 statements  

« prev     ^ index     » next       coverage.py v7.9.0, created at 2025-06-13 07:43 +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 Sense(PolishBaseModel): 

28 glosses: list[str] = [] 

29 tags: list[str] = [] 

30 raw_tags: list[str] = [] 

31 topics: list[str] = [] 

32 categories: list[str] = [] 

33 sense_index: str = "" 

34 examples: list[Example] = [] 

35 alt_of: list[AltForm] = [] 

36 form_of: list[AltForm] = [] 

37 notes: list[str] = [] 

38 

39 

40class Translation(PolishBaseModel): 

41 lang_code: str = "" 

42 lang: str = "" 

43 word: str = "" 

44 sense_index: str = "" 

45 tags: list[str] = [] 

46 raw_tags: list[str] = [] 

47 roman: str = "" 

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

49 

50 

51class Sound(PolishBaseModel): 

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

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

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

55 wav_url: str = "" 

56 oga_url: str = "" 

57 ogg_url: str = "" 

58 mp3_url: str = "" 

59 opus_url: str = "" 

60 flac_url: str = "" 

61 tags: list[str] = [] 

62 raw_tags: list[str] = [] 

63 

64 

65class Linkage(PolishBaseModel): 

66 word: str 

67 tags: list[str] = [] 

68 raw_tags: list[str] = [] 

69 sense_index: str = "" 

70 topics: list[str] = [] 

71 furigana: str = "" 

72 translation: str = "" 

73 

74 

75class Form(PolishBaseModel): 

76 form: str = "" 

77 tags: list[str] = [] 

78 raw_tags: list[str] = [] 

79 sense_index: str = "" 

80 

81 

82class Note(PolishBaseModel): 

83 sense_index: str = "" 

84 text: str = Field(min_length=1) 

85 

86 

87class WordEntry(PolishBaseModel): 

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

89 

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

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

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

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

94 pos_text: str = "" 

95 senses: list[Sense] = [] 

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

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

98 categories: list[str] = [] 

99 tags: list[str] = [] 

100 raw_tags: list[str] = [] 

101 etymology_texts: list[str] = [] 

102 translations: list[Translation] = [] 

103 sounds: list[Sound] = [] 

104 antonyms: list[Linkage] = [] 

105 hypernyms: list[Linkage] = [] 

106 hyponyms: list[Linkage] = [] 

107 holonyms: list[Linkage] = [] 

108 meronyms: list[Linkage] = [] 

109 related: list[Linkage] = [] 

110 proverbs: list[Linkage] = [] 

111 synonyms: list[Linkage] = [] 

112 derived: list[Linkage] = [] 

113 forms: list[Form] = [] 

114 hyphenation: str = ""