Ejemplo n.º 1
0
 def getword(self, word):
     """Translates one word into Galbraithanese."""
     if all(map(lambda x: x.isdigit(), list(word))) and word:
         return Numbers.galbraithanese_number(int(word))
     elif set(list(word))==set(['\x98', '\x83', '\xe2']):
         return word
     elif word=="love":
         return random.choice(["óstīðōyó", "ᵲōsnôfôbr", "lēvēy", "jūkwôbr"])
     elif word=="loved":
         return random.choice(["óstīðōyóēnē", "ᵲōsnôfôbrēnē", "lēvēyēnē", "jūkwôbrēnē"])
     elif word=="loving":
         return random.choice(["óstīðōyóîgē", "ᵲōsnôfôbrîgē", "lēvēyîgē", "jūkwôbrîgē"])
     elif word in self.dictionary:
         return self.dictionary[word]
     elif word[:-2] in self.dictionary and word[-2:]=="ly":
         return self.dictionary[word[:-2]]+"əʃ"
     elif word[:-3]+"y" in self.dictionary and word[-2:]=="ily":
         return self.dictionary[word[:-3]+y]+"əʃ"
     elif word[:-3] in self.dictionary and word[-3:]=="ing":
         return self.dictionary[word[:-3]]+"îgē"
     elif word[:-3]+"e" in self.dictionary and word[-3:]=="ing":
         return self.dictionary[word[:-3]+"e"]+"îgē"
     elif word[:-2] in self.dictionary and word[-2:]=="ed":
         return self.dictionary[word[:-2]]+"ēnē"
     elif word[:-1] in self.dictionary and word[-1]=="d":
         return self.dictionary[word[:-1]]+"ēnē"
     elif word[:-1] in self.dictionary and word[-1]=="s":
         return self.dictionary[word[:-1]]+"glôb"
     elif word[:-2] in self.dictionary and word[-2:]=="es":
         return self.dictionary[word[:-2]]+"glôb"
     else:
         return "?"*len(word)