RecursionCat/AbhayaWordLookup
0
1class Vowels:2 """Class Consonants: Defines a Vowel and its features3 Arguments:4 grapheme: Letter Symbol5 Height: 0 - low, 1 - mid, 2 - high6 Backness: 0 - back, 1 - central, 2 - front7 Length: 0 - Short, 1 - Long, 2 - Dipthong8 dependent: True if matra, false otherwise9 """10 11 def __init__(self, grapheme:str, height:int, backness:int, length:int, dependent:bool ) -> None:12 self.grapheme = grapheme13 self.height = height14 self.backness = backness15 self.length = length16 self.dependent = dependent17 18 19class Consonants:20 """Class Consonants: Defines a Consonant and its features21 22 Arguments:23 Grapheme: Letter symbol24 Place: 0 - Velar, 1 - Palatial, 2 - Retroflex, 3 - Dental, 4 - Labial, 5 - Glottal25 Manner: 0 - Stop, 1 - Nasal, 2 - affricate, 3 - approximant, 4 - Latteral Approximant, 5 - Fricative26 Voicing: 0 - Voiceless, 1 - Voiced27 Aspiration: 0 - Unaspirated, 1 - Aspirated, 2 - Not Applicable28 """29 30 def __init__(self, grapheme:str, place:int, manner:int, voicing:int, aspiration:int ) -> None:31 32 self.grapheme = grapheme33 self.place = place34 self.manner = manner35 self.voicing = voicing36 self.aspiration = aspiration37 38 39def jsonToClass(jsonObj: dict) -> Vowels | Consonants:40 if jsonObj['type'] == 'vowel':41 return Vowels(jsonObj['grapheme'], height=jsonObj['height'], backness=jsonObj['backness'], length=jsonObj['length'], dependent=jsonObj['dependent'])42 else:43 return Consonants(jsonObj['grapheme'], place=jsonObj['place'], manner=jsonObj['manner'], voicing=jsonObj['voicing'], aspiration=jsonObj['aspiration'])