forked from tdwojak/Python2018
21 lines
557 B
Python
21 lines
557 B
Python
import glob
|
|
|
|
filelist = glob.glob('scores\\*.bleu')
|
|
bleu_filename = ''
|
|
max_bleu = 0
|
|
|
|
|
|
def find_bleu(bleu_list, max_bleu):
|
|
for bleufile in bleu_list:
|
|
content = open(bleufile, 'r').read()
|
|
bleu = content.split(r',')
|
|
bleu_datum = bleu[0].split()
|
|
if max_bleu <= float(bleu_datum[2]):
|
|
max_bleu = float(bleu_datum[2])
|
|
bleu_filename = bleufile
|
|
return bleu_filename, max_bleu
|
|
|
|
|
|
# filename, max_bleu = find_bleu([filelist[0]], max_bleu)
|
|
filename, max_bleu = find_bleu(filelist, max_bleu)
|
|
print(filename) |