1
0
Fork 0

Praca domowa nr 2 (labs03)

Rozwiązanie - Piotr Bystrzycki - nr indeksu 45146
This commit is contained in:
s45146 2017-12-09 18:18:34 +01:00
parent 5352a03460
commit ed8ed03e5b
1 changed files with 20 additions and 1 deletions

View File

@ -9,8 +9,27 @@ Wyświetl tylko pełną nazwe pliku (wraz z ścieżką).
""" """
import glob
def maxBleu(dir = './scores/', retmax = False):
maxbleu, fmax = None, None
for fn in glob.glob(dir+'model.iter*.npz.bleu'):
with open(fn, 'r') as f:
nmax = f.readline().replace(',', '').split(' ')[2]
if (maxbleu is None) or (float(maxbleu) < float(nmax)):
maxbleu = nmax
fmax = fn
else:
pass
if retmax:
retval = fmax+' : '+maxbleu
else:
retval = fmax
return retval
if __name__ == "__main__": if __name__ == "__main__":
pass #print(maxBleu(retmax = True))
print(maxBleu())