forked from tdwojak/Python2017
task05 done
This commit is contained in:
parent
984bf73c46
commit
5a79c51337
26
labs03/task05.py
Normal file
26
labs03/task05.py
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python2
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import glob
|
||||
|
||||
path = 'scores'
|
||||
os.chdir(path)
|
||||
|
||||
max_file_name = ''
|
||||
max_bleu = 0
|
||||
|
||||
file_list = glob.glob('model.iter[0-9][0-9][0-9][0-9][0-9].npz.bleu') + glob.glob('model.iter[0-9][0-9][0-9][0-9][0-9][0-9].npz.bleu')
|
||||
|
||||
for file in file_list:
|
||||
with open(file, 'r') as f:
|
||||
for line in f.readlines():
|
||||
fc = line.find(',')
|
||||
feq = line.find('=') + 1
|
||||
|
||||
bleu = float(line[feq:fc])
|
||||
|
||||
if bleu > max_bleu:
|
||||
max_bleu = bleu
|
||||
max_file_name = file
|
||||
|
||||
print(os.getcwd() + '\\' + max_file_name)
|
Loading…
Reference in New Issue
Block a user