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

78 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 PortugueseBaseModel(BaseModel): 

5 model_config = ConfigDict( 

6 extra="forbid", 

7 strict=True, 

8 validate_assignment=True, 

9 validate_default=True, 

10 ) 

11 

12 

13class Example(PortugueseBaseModel): 

14 text: str = "" 

15 translation: str = "" 

16 ref: str = "" 

17 

18 

19class Sense(PortugueseBaseModel): 

20 glosses: list[str] = [] 

21 tags: list[str] = [] 

22 raw_tags: list[str] = [] 

23 categories: list[str] = [] 

24 topics: list[str] = [] 

25 examples: list[Example] = [] 

26 

27 

28class Translation(PortugueseBaseModel): 

29 lang_code: str = Field( 

30 default="", 

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

32 ) 

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

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

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

36 sense_index: int = Field( 

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

38 ) 

39 tags: list[str] = [] 

40 raw_tags: list[str] = [] 

41 roman: str = "" 

42 

43 

44class Linkage(PortugueseBaseModel): 

45 word: str 

46 tags: list[str] = [] 

47 raw_tags: list[str] = [] 

48 senses: list[Sense] = [] 

49 sense: str = "" 

50 sense_index: int = Field( 

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

52 ) 

53 source: str = "" 

54 roman: str = "" 

55 

56 

57class Sound(PortugueseBaseModel): 

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 Form(PortugueseBaseModel): 

71 form: str = "" 

72 tags: list[str] = [] 

73 raw_tags: list[str] = [] 

74 

75 

76class WordEntry(PortugueseBaseModel): 

77 model_config = ConfigDict(title="Portuguese Wiktionary") 

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

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

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

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

82 pos_title: str = "" 

83 senses: list[Sense] = [] 

84 categories: list[str] = [] 

85 tags: list[str] = [] 

86 raw_tags: list[str] = [] 

87 topics: list[str] = [] 

88 translations: list[Translation] = [] 

89 expressions: list[Linkage] = [] 

90 antonyms: list[Linkage] = [] 

91 synonyms: list[Linkage] = [] 

92 derived: list[Linkage] = [] 

93 anagrams: list[Linkage] = [] 

94 hypernyms: list[Linkage] = [] 

95 related: list[Linkage] = [] 

96 hyponyms: list[Linkage] = [] 

97 homophones: list[Linkage] = [] 

98 homonyms: list[Linkage] = [] 

99 paronyms: list[Linkage] = [] 

100 phraseology: list[Linkage] = [] 

101 etymology_texts: list[str] = [] 

102 sounds: list[Sound] = [] 

103 forms: list[Form] = [] 

104 notes: list[str] = [] 

105 cognates: list[Translation] = [] 

106 descendants: list[Translation] = []