def main(): if len(sys.argv) > 2 or len(sys.argv) == 1: logger.error('Invalid number of parameters, the program can not be executed!') logger.error('Program going to exit!') sys.exit() try: path = sys.argv[1] rawtxt = io.readRawFile(path) result = zuma.spiral(rawtxt) except IOError: logger.error('Not such data file!')
def test_read(self): raw = open('test/data/simple.txt', 'r').read() ioreaded = io.readRawFile('test/data/simple.txt') self.assertEqual(raw, ioreaded)
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')
def test_pickConfig(self): rawtxt = readRawFile('test/data/simple.txt') config, classify = sorter.pickup(rawtxt) self.assertEqual(config['verbose'], 'True')
def test_pickup(self): rawtxt = readRawFile('test/data/simpleHasHan.txt') config, classify = sorter.pickup(rawtxt) print classify['extra'] self.assertEqual(classify['extra'][0], 'mht')
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')
def test_pickupClass(self): rawtxt = readRawFile('test/data/simple.txt') config, classify = sorter.pickup(rawtxt) self.assertEqual(classify['place'][0], 'shenzhen')
def test_classPinyinify(self): rawtxt = readRawFile('test/data/simpleHasHan.txt') config, classify = pickup(rawtxt) rst = pinyin.classPinyinify(classify) self.assertEqual(rst[0][3], 'chaozhao')
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')
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')