Ejemplo n.º 1
0
	def test_segmentation(self):
		rst = pinyin.segmentation(u'拼音分词')
		self.assertEqual(rst[0], u'pin')
		self.assertEqual(rst[2], u'fen')
Ejemplo n.º 2
0
def abbreviation(name):
	def takeFirst(chichar):
		return chichar[0]
	if pinyin.hasHan(name) is True:
		return ''.join(list(map(_[0], pinyin.segmentation(name))))