def test_hasHan(self): self.assertEqual(True, pinyin.hasHan(u'狗')) self.assertEqual(False, pinyin.hasHan(u'dog'))
def abbreviation(name): def takeFirst(chichar): return chichar[0] if pinyin.hasHan(name) is True: return ''.join(list(map(_[0], pinyin.segmentation(name))))