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

85 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 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 bold_text_offsets: list[tuple[int, int]] = [] 

16 translation: str = "" 

17 ref: str = "" 

18 

19 

20class AltForm(PortugueseBaseModel): 

21 word: str 

22 

23 

24class Sense(PortugueseBaseModel): 

25 glosses: list[str] = [] 

26 tags: list[str] = [] 

27 raw_tags: list[str] = [] 

28 categories: list[str] = [] 

29 topics: list[str] = [] 

30 examples: list[Example] = [] 

31 form_of: list[AltForm] = [] 

32 

33 

34class Translation(PortugueseBaseModel): 

35 lang_code: str = Field( 

36 default="", 

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

38 ) 

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

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

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

42 sense_index: int = Field( 

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

44 ) 

45 tags: list[str] = [] 

46 raw_tags: list[str] = [] 

47 roman: str = "" 

48 

49 

50class Linkage(PortugueseBaseModel): 

51 word: str 

52 tags: list[str] = [] 

53 raw_tags: list[str] = [] 

54 senses: list[Sense] = [] 

55 sense: str = "" 

56 sense_index: int = Field( 

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

58 ) 

59 source: str = "" 

60 roman: str = "" 

61 

62 

63class Sound(PortugueseBaseModel): 

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

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

66 wav_url: str = "" 

67 oga_url: str = "" 

68 ogg_url: str = "" 

69 mp3_url: str = "" 

70 opus_url: str = "" 

71 flac_url: str = "" 

72 tags: list[str] = [] 

73 raw_tags: list[str] = [] 

74 zh_pron: str = "" 

75 

76 

77class Form(PortugueseBaseModel): 

78 form: str = "" 

79 tags: list[str] = [] 

80 raw_tags: list[str] = [] 

81 

82 

83class WordEntry(PortugueseBaseModel): 

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

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

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

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

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

89 pos_title: str = "" 

90 senses: list[Sense] = [] 

91 categories: list[str] = [] 

92 tags: list[str] = [] 

93 raw_tags: list[str] = [] 

94 topics: list[str] = [] 

95 translations: list[Translation] = [] 

96 expressions: list[Linkage] = [] 

97 antonyms: list[Linkage] = [] 

98 synonyms: list[Linkage] = [] 

99 derived: list[Linkage] = [] 

100 anagrams: list[Linkage] = [] 

101 hypernyms: list[Linkage] = [] 

102 related: list[Linkage] = [] 

103 hyponyms: list[Linkage] = [] 

104 homophones: list[Linkage] = [] 

105 homonyms: list[Linkage] = [] 

106 paronyms: list[Linkage] = [] 

107 phraseology: list[Linkage] = [] 

108 etymology_texts: list[str] = [] 

109 sounds: list[Sound] = [] 

110 forms: list[Form] = [] 

111 notes: list[str] = [] 

112 cognates: list[Translation] = [] 

113 descendants: list[Translation] = [] 

114 abbreviations: list[Linkage] = [] 

115 paronyms: list[Linkage] = []