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

86 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 TurkishBaseModel(BaseModel): 

5 model_config = ConfigDict( 

6 extra="forbid", 

7 strict=True, 

8 validate_assignment=True, 

9 validate_default=True, 

10 ) 

11 

12 

13class Example(TurkishBaseModel): 

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 tags: list[str] = [] 

20 raw_tags: list[str] = [] 

21 

22 

23class AltForm(TurkishBaseModel): 

24 word: str 

25 

26 

27class Sense(TurkishBaseModel): 

28 glosses: list[str] = [] 

29 tags: list[str] = [] 

30 raw_tags: list[str] = [] 

31 categories: list[str] = [] 

32 topics: list[str] = [] 

33 examples: list[Example] = [] 

34 form_of: list[AltForm] = [] 

35 alt_of: list[AltForm] = [] 

36 

37 

38class Form(TurkishBaseModel): 

39 form: str 

40 tags: list[str] = [] 

41 raw_tags: list[str] = [] 

42 roman: str = "" 

43 

44 

45class Sound(TurkishBaseModel): 

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

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

48 wav_url: str = "" 

49 oga_url: str = "" 

50 ogg_url: str = "" 

51 mp3_url: str = "" 

52 opus_url: str = "" 

53 flac_url: str = "" 

54 tags: list[str] = [] 

55 raw_tags: list[str] = [] 

56 roman: str = "" 

57 homophone: str = "" 

58 rhymes: str = "" 

59 

60 

61class Translation(TurkishBaseModel): 

62 lang_code: str = Field( 

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

64 ) 

65 lang: str = Field(description="Translation language name") 

66 word: str = Field(description="Translation term") 

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

68 tags: list[str] = [] 

69 raw_tags: list[str] = [] 

70 roman: str = "" 

71 

72 

73class Linkage(TurkishBaseModel): 

74 word: str 

75 tags: list[str] = [] 

76 raw_tags: list[str] = [] 

77 roman: str = "" 

78 source: str = "" 

79 sense: str = "" 

80 

81 

82class Hyphenation(TurkishBaseModel): 

83 parts: list[str] = [] 

84 tags: list[str] = [] 

85 raw_tags: list[str] = [] 

86 

87 

88class WordEntry(TurkishBaseModel): 

89 model_config = ConfigDict(title="Turkish Wiktionary") 

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

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

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

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

94 pos_title: str = "" 

95 senses: list[Sense] = [] 

96 categories: list[str] = [] 

97 tags: list[str] = [] 

98 raw_tags: list[str] = [] 

99 forms: list[Form] = [] 

100 etymology_texts: list[str] = [] 

101 sounds: list[Sound] = [] 

102 hyphenations: list[Hyphenation] = [] 

103 translations: list[Translation] = [] 

104 synonyms: list[Linkage] = [] 

105 antonyms: list[Linkage] = [] 

106 hypernyms: list[Linkage] = [] 

107 hyponyms: list[Linkage] = [] 

108 related: list[Linkage] = [] 

109 derived: list[Linkage] = [] 

110 proverbs: list[Linkage] = [] 

111 idioms: list[Linkage] = [] 

112 notes: list[str] = [] 

113 anagrams: list[Linkage] = []