forked from tdwojak/Python2017
Praca domowa nr 2 (labs03)
Rozwiązanie - Piotr Bystrzycki - nr indeksu 45146
This commit is contained in:
parent
5352a03460
commit
ed8ed03e5b
@ -9,8 +9,27 @@ Wyświetl tylko pełną nazwe pliku (wraz z ścieżką).
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if __name__ == "__main__":
|
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
|
pass
|
||||||
|
if retmax:
|
||||||
|
retval = fmax+' : '+maxbleu
|
||||||
|
else:
|
||||||
|
retval = fmax
|
||||||
|
return retval
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
#print(maxBleu(retmax = True))
|
||||||
|
print(maxBleu())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user