def test_reverse_words(self): """ unittest for reverse a Tamil string""" for ( word ) in u"இந்த (C) tamil முத்தையா அண்ணாமலை 2013 இந்த ஒரு எழில் தமிழ் நிரலாக்க மொழி உதாரணம்".split(): rword = utf8.reverse_word(word) self.assertTrue(utf8.get_letters(rword)[0] == utf8.get_letters(word)[-1]) return
def test_reverse_words( self ): """ unittest for reverse a Tamil string""" print utf8.get_letters(u"இந்த") print u"".join(utf8.get_letters(u"இந்த")) for word in u"இந்த (C) tamil முத்தையா அண்ணாமலை 2013 இந்த ஒரு எழில் தமிழ் நிரலாக்க மொழி உதாரணம்".split(): rword = utf8.reverse_word(word) print word,rword self.assertTrue( utf8.get_letters(rword)[0] == utf8.get_letters(word)[-1] ) return
def setSuffixes(self): self.replace_suffixes = { u"மா": u"", u"பேர்": u"", u"அதி": u"", u"பெரிய": u"", u"பெரு": u"", u"சின்ன": u"", u"ஆதி": u"", u"சிறு": u"", u"அக்": u"", u"இக்": u"", u"எக்": u"", } self.possible_suffixes = [utf8.reverse_word(word) for word in self.replace_suffixes.keys()]
def setSuffixes(self): self.replace_suffixes = { u"மா": u"", u"பேர்": u"", u"அதி": u"", u"பெரிய": u"", u"பெரு": u"", u"சின்ன": u"", u"ஆதி": u"", u"சிறு": u"", u"அக்": u"", u"இக்": u"", u"எக்": u"", } self.possible_suffixes = [ utf8.reverse_word(word) for word in self.replace_suffixes.keys() ]
def removePrefix(self, word): word_lett = utf8.get_letters(word) word_lett.reverse() a, b = self.removeSuffix(u"".join(word_lett)) return [utf8.reverse_word(a), b]
def prepareSuffixes(self): assert self.possible_suffixes # reverse the words in each letter. for word in self.possible_suffixes: self.reversed_suffixes.append(utf8.reverse_word(word)) return
def reverse(self,word): if self.is_tamil: rev_word = utf8.reverse_word(word) else: rev_word = word[::-1] return rev_word
def reverse(self, word): if self.is_tamil: rev_word = utf8.reverse_word(word) else: rev_word = word[::-1] return rev_word
def removePrefix(self,word): word_lett = utf8.get_letters(word) word_lett.reverse() a,b = self.removeSuffix(u"".join(word_lett)) return [utf8.reverse_word(a),b]
def prepareSuffixes(self): assert self.possible_suffixes # reverse the words in each letter. for word in self.possible_suffixes: self.reversed_suffixes.append( utf8.reverse_word(word) ) return