Ejemplo n.º 1
0
	def test_op2File(self):
		rawtxt = io.readRawFile('test/data/simple.txt')
		config, classify = sorter.pickup(rawtxt)
		rst = dog.run(classify)
		output = '\n'.join(util.unpackStrListRecur(rst))
		io.op2File(output, 'myoutput.txt')
Ejemplo n.º 2
0
	def test_pickup(self):
		rawtxt = readRawFile('test/data/simpleHasHan.txt')
		config, classify = sorter.pickup(rawtxt)
		print classify['extra']
		self.assertEqual(classify['extra'][0], 'mht')
Ejemplo n.º 3
0
	def test_pickConfig(self):
		rawtxt = readRawFile('test/data/simple.txt')
		config, classify = sorter.pickup(rawtxt)
		self.assertEqual(config['verbose'], 'True')
Ejemplo n.º 4
0
	def test_abbreviation(self):
		rawtxt = readRawFile('test/data/simpleHasHan.txt')
		config, classify = sorter.pickup(rawtxt)
		rst = sorter.pickupExtra(classify)
		self.assertEqual(len(rst), 2)
		self.assertEqual(rst[0],'mht')
Ejemplo n.º 5
0
	def test_pickupClass(self):
		rawtxt = readRawFile('test/data/simple.txt')
		config, classify = sorter.pickup(rawtxt)
		self.assertEqual(classify['place'][0], 'shenzhen')
Ejemplo n.º 6
0
	def test_classPinyinify(self):
		rawtxt = readRawFile('test/data/simpleHasHan.txt')
		config, classify = pickup(rawtxt)
		rst = pinyin.classPinyinify(classify)
		self.assertEqual(rst[0][3], 'chaozhao')
Ejemplo n.º 7
0
	def test_run(self):
		rawtxt = readRawFile('test/data/simple.txt')
		config, classify = pickup(rawtxt)
		rst = dog.run(classify)
		self.assertEqual(rst[1][2][0][1], 'mahuafeng1234')
Ejemplo n.º 8
0
	def test_run(self):
		rawtxt = readRawFile('test/data/simple.txt')
		config, classify = pickup(rawtxt)
		rst = cat.run(classify)
		self.assertEqual(rst[0][1][0], '123tnecnet')