Ejemplo n.º 1
0
 def test_sortAlphabet(self):
     text = "abdegijklmnorstuvwāēěīūǎφ"
     results = utils.sortAlphabet(text)
     expected = u"ABDEGIJKLMNORSTTHUVW"
     self.assertEquals("".join(sorted(results.keys())), expected)
     self.assertEquals(sorted(results["A"]), [u'a', u'\u0101', u'\u01ce'])
     self.assertEquals(sorted(results["E"]), [u'e', u'\u0113', u'\u011b'])
     self.assertEquals(sorted(results["I"]), [u'i', u'\u012b'])
     self.assertEquals(sorted(results["O"]), [u'o'])
     self.assertEquals(sorted(results["U"]), [u'u', u'\u016b'])
     self.assertEquals(sorted(results["TH"]), [u'\u03c6'])
Ejemplo n.º 2
0
 def getAlphabetData(docs):
     letters = set()
     for doc in docs:
         letters.add(getInitialLetter(doc[model.langCode]))
     return utils.sortAlphabet("".join(letters))