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

85 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-25 10:11 +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 translation: str = "" 

16 ref: str = "" 

17 roman: str = "" 

18 literal_meaning: str = "" 

19 

20 

21class AltForm(PolishBaseModel): 

22 word: str 

23 

24 

25class Sense(PolishBaseModel): 

26 glosses: list[str] = [] 

27 tags: list[str] = [] 

28 raw_tags: list[str] = [] 

29 topics: list[str] = [] 

30 categories: list[str] = [] 

31 sense_index: str = "" 

32 examples: list[Example] = [] 

33 alt_of: list[AltForm] = [] 

34 form_of: list[AltForm] = [] 

35 

36 

37class Translation(PolishBaseModel): 

38 lang_code: str = "" 

39 lang: str = "" 

40 word: str = "" 

41 sense_index: str = "" 

42 tags: list[str] = [] 

43 raw_tags: list[str] = [] 

44 roman: str = "" 

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

46 

47 

48class Sound(PolishBaseModel): 

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

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

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

52 wav_url: str = "" 

53 oga_url: str = "" 

54 ogg_url: str = "" 

55 mp3_url: str = "" 

56 opus_url: str = "" 

57 flac_url: str = "" 

58 tags: list[str] = [] 

59 raw_tags: list[str] = [] 

60 

61 

62class Linkage(PolishBaseModel): 

63 word: str 

64 tags: list[str] = [] 

65 raw_tags: list[str] = [] 

66 sense_index: str = "" 

67 topics: list[str] = [] 

68 furigana: str = "" 

69 translation: str = "" 

70 

71 

72class Form(PolishBaseModel): 

73 form: str = "" 

74 tags: list[str] = [] 

75 raw_tags: list[str] = [] 

76 sense_index: str = "" 

77 

78 

79class Note(PolishBaseModel): 

80 sense_index: str = "" 

81 text: str = Field(min_length=1) 

82 

83 

84class WordEntry(PolishBaseModel): 

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

86 

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

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

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

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

91 pos_text: str = "" 

92 senses: list[Sense] = [] 

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

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

95 categories: list[str] = [] 

96 tags: list[str] = [] 

97 raw_tags: list[str] = [] 

98 etymology_texts: list[str] = [] 

99 translations: list[Translation] = [] 

100 sounds: list[Sound] = [] 

101 antonyms: list[Linkage] = [] 

102 hypernyms: list[Linkage] = [] 

103 hyponyms: list[Linkage] = [] 

104 holonyms: list[Linkage] = [] 

105 meronyms: list[Linkage] = [] 

106 related: list[Linkage] = [] 

107 proverbs: list[Linkage] = [] 

108 synonyms: list[Linkage] = [] 

109 derived: list[Linkage] = [] 

110 forms: list[Form] = [] 

111 notes: list[Note] = []