예제 #1
0
파일: mainTest.py 프로젝트: Fansion/CCUED
def getScoreTest():
	datalist = ['这手机的画面极好,操作也比较流畅。不过拍照真的太烂了!系统也不好。',
    '今天终于和交行脱离关系了。你们的服务态度值得肯定!!!但是没法儿,  ,,    我这个人就是不待见罗嗦和繁琐。PS:销卡的时候还倒贴了9块4毛6的卡费,存款都存成负数了,惭愧。多亏这是张借记卡,信用卡还了得..。',
    '我来到北京清华大学',"abddef"]
   	dlist = []
   	for data in datalist:
   		dlist.append(data.decode('utf-8')) 
	print main.getScore(dlist)
def compare_solutions(tag1, tag2):
    files = zip(filter_solutions(tag1), filter_solutions(tag2))
    total = 0
    with io.open('log_diff_%s-%s.txt' % (tag1, tag2), 'w') as log:
        for f1, f2 in files:
            assert (f1['set_id'] == info2['set_id'])
            scores1 = mm.getScore(f1['fname'])
            scores2 = mm.getScore(f2['fname'])
            assert (len(scores1) == len(scores2))
            diff = sum(scores2) - sum(scores1)
            diffa = [b - a for a, b in zip(scores1, scores2)]

            msg = 'Id = %d %.0f %s' % (id1, diff / len(scores1), diffa)
            print(msg)
            log.write(msg + '\n')
            total += diff / len(scores1)
        msg = 'Total diff = %.2f' % total
        print(msg)
        log.write(msg + '\n')
def compare_solutions(tag1, tag2):
    files = zip(filter_solutions(tag1), filter_solutions(tag2))
    total = 0
    with io.open('log_diff_%s-%s.txt' % (tag1, tag2), 'w') as log:
        for f1, f2 in files:
            assert(f1['set_id'] == info2['set_id'])
            scores1 = mm.getScore(f1['fname'])
            scores2 = mm.getScore(f2['fname'])
            assert(len(scores1) == len(scores2))
            diff = sum(scores2) - sum(scores1)
            diffa = [b - a for a, b in zip(scores1, scores2)]

            msg = 'Id = %d %.0f %s' % (id1, diff / len(scores1), diffa)
            print(msg)
            log.write(msg + '\n')
            total += diff / len(scores1)
        msg = 'Total diff = %.2f' % total
        print(msg)
        log.write(msg + '\n')
def score_solution(f, log):
    scores0 = mm.getScore(f['fname'])
    scores, pscores = zip(*scores0)
    avgScore = sum(scores) // len(scores)
    avgPScore = sum(pscores) // len(pscores)
    avgTotal = (sum(scores) + sum(pscores)) // len(pscores)
    msg = 'Id = %d, score = %d (%d + %d)' % (f['set_id'], avgTotal, avgScore,
                                             avgPScore)
    print(msg)
    print(scores0)
    log.write(msg + '\n')
    return (scores, pscores)
def score_solution(f, log):
    scores0 = mm.getScore(f['fname'])
    scores, pscores = zip(*scores0)
    avgScore = sum(scores) // len(scores)
    avgPScore = sum(pscores) // len(pscores)
    avgTotal = (sum(scores) + sum(pscores)) // len(pscores)
    msg = 'Id = %d, score = %d (%d + %d)' % (f['set_id'],
                                             avgTotal,
                                             avgScore,
                                             avgPScore)
    print(msg)
    print(scores0)
    log.write(msg + '\n')
    return (scores, pscores)
예제 #6
0
파일: mainTest.py 프로젝트: Fansion/CCUED
def mTest():
	# Load dataList
	dataList = main.getTextData('datalist.txt')
	print main.getScore(dataList)