From 56c557a3193a312396a22b9aabe51344891eb0d2 Mon Sep 17 00:00:00 2001 From: dkuam Date: Sun, 3 Jun 2018 07:24:24 +0200 Subject: [PATCH] 'zadaniedomowe1' --- .idea/Python2018.iml | 2 +- .idea/misc.xml | 2 +- .idea/workspace.xml | 183 ++++++++++++++++++ ZadanieDomowe1/labs02/task07.py | 32 +++ ZadanieDomowe1/labs02/task08.py | 31 +++ ZadanieDomowe1/labs02/task09.py | 26 +++ ZadanieDomowe1/labs02/task10.py | 40 ++++ ZadanieDomowe1/labs02/task11.py | 32 +++ ZadanieDomowe1/labs04/README.md | 34 ++++ .../labs04/examples/06_execution_time.py | 37 ++++ .../labs04/examples/25_ip2geolocation.py | 31 +++ ZadanieDomowe1/labs04/examples/fib.py | 47 +++++ ZadanieDomowe1/labs04/examples/myip.py | 11 ++ ZadanieDomowe1/labs04/examples/wc.py | 39 ++++ ZadanieDomowe1/labs04/haslo.txt | 2 + ZadanieDomowe1/labs04/haslo2.txt | 1 + .../labs04/scores/model.iter10000.npz.bleu | 1 + .../labs04/scores/model.iter100000.npz.bleu | 1 + .../labs04/scores/model.iter110000.npz.bleu | 1 + .../labs04/scores/model.iter120000.npz.bleu | 1 + .../labs04/scores/model.iter130000.npz.bleu | 1 + .../labs04/scores/model.iter140000.npz.bleu | 1 + .../labs04/scores/model.iter150000.npz.bleu | 1 + .../labs04/scores/model.iter160000.npz.bleu | 1 + .../labs04/scores/model.iter170000.npz.bleu | 1 + .../labs04/scores/model.iter180000.npz.bleu | 1 + .../labs04/scores/model.iter190000.npz.bleu | 1 + .../labs04/scores/model.iter20000.npz.bleu | 1 + .../labs04/scores/model.iter200000.npz.bleu | 1 + .../labs04/scores/model.iter210000.npz.bleu | 1 + .../labs04/scores/model.iter220000.npz.bleu | 1 + .../labs04/scores/model.iter230000.npz.bleu | 1 + .../labs04/scores/model.iter240000.npz.bleu | 1 + .../labs04/scores/model.iter250000.npz.bleu | 1 + .../labs04/scores/model.iter260000.npz.bleu | 1 + .../labs04/scores/model.iter270000.npz.bleu | 1 + .../labs04/scores/model.iter280000.npz.bleu | 1 + .../labs04/scores/model.iter290000.npz.bleu | 1 + .../labs04/scores/model.iter30000.npz.bleu | 1 + .../labs04/scores/model.iter300000.npz.bleu | 1 + .../labs04/scores/model.iter310000.npz.bleu | 1 + .../labs04/scores/model.iter320000.npz.bleu | 1 + .../labs04/scores/model.iter330000.npz.bleu | 1 + .../labs04/scores/model.iter340000.npz.bleu | 1 + .../labs04/scores/model.iter350000.npz.bleu | 1 + .../labs04/scores/model.iter360000.npz.bleu | 1 + .../labs04/scores/model.iter370000.npz.bleu | 1 + .../labs04/scores/model.iter380000.npz.bleu | 1 + .../labs04/scores/model.iter390000.npz.bleu | 1 + .../labs04/scores/model.iter40000.npz.bleu | 1 + .../labs04/scores/model.iter400000.npz.bleu | 1 + .../labs04/scores/model.iter410000.npz.bleu | 1 + .../labs04/scores/model.iter420000.npz.bleu | 1 + .../labs04/scores/model.iter430000.npz.bleu | 1 + .../labs04/scores/model.iter440000.npz.bleu | 1 + .../labs04/scores/model.iter450000.npz.bleu | 1 + .../labs04/scores/model.iter460000.npz.bleu | 1 + .../labs04/scores/model.iter470000.npz.bleu | 1 + .../labs04/scores/model.iter480000.npz.bleu | 1 + .../labs04/scores/model.iter490000.npz.bleu | 1 + .../labs04/scores/model.iter50000.npz.bleu | 1 + .../labs04/scores/model.iter500000.npz.bleu | 1 + .../labs04/scores/model.iter510000.npz.bleu | 1 + .../labs04/scores/model.iter520000.npz.bleu | 1 + .../labs04/scores/model.iter530000.npz.bleu | 1 + .../labs04/scores/model.iter540000.npz.bleu | 1 + .../labs04/scores/model.iter550000.npz.bleu | 1 + .../labs04/scores/model.iter560000.npz.bleu | 1 + .../labs04/scores/model.iter570000.npz.bleu | 1 + .../labs04/scores/model.iter580000.npz.bleu | 1 + .../labs04/scores/model.iter590000.npz.bleu | 1 + .../labs04/scores/model.iter60000.npz.bleu | 1 + .../labs04/scores/model.iter600000.npz.bleu | 1 + .../labs04/scores/model.iter610000.npz.bleu | 1 + .../labs04/scores/model.iter620000.npz.bleu | 1 + .../labs04/scores/model.iter630000.npz.bleu | 1 + .../labs04/scores/model.iter640000.npz.bleu | 1 + .../labs04/scores/model.iter70000.npz.bleu | 1 + .../labs04/scores/model.iter80000.npz.bleu | 1 + .../labs04/scores/model.iter90000.npz.bleu | 1 + ZadanieDomowe1/labs04/task05.py | 12 ++ 81 files changed, 624 insertions(+), 2 deletions(-) create mode 100644 .idea/workspace.xml create mode 100644 ZadanieDomowe1/labs02/task07.py create mode 100644 ZadanieDomowe1/labs02/task08.py create mode 100644 ZadanieDomowe1/labs02/task09.py create mode 100644 ZadanieDomowe1/labs02/task10.py create mode 100644 ZadanieDomowe1/labs02/task11.py create mode 100644 ZadanieDomowe1/labs04/README.md create mode 100644 ZadanieDomowe1/labs04/examples/06_execution_time.py create mode 100644 ZadanieDomowe1/labs04/examples/25_ip2geolocation.py create mode 100644 ZadanieDomowe1/labs04/examples/fib.py create mode 100644 ZadanieDomowe1/labs04/examples/myip.py create mode 100644 ZadanieDomowe1/labs04/examples/wc.py create mode 100644 ZadanieDomowe1/labs04/haslo.txt create mode 100644 ZadanieDomowe1/labs04/haslo2.txt create mode 100644 ZadanieDomowe1/labs04/scores/model.iter10000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter100000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter110000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter120000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter130000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter140000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter150000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter160000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter170000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter180000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter190000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter20000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter200000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter210000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter220000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter230000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter240000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter250000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter260000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter270000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter280000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter290000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter30000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter300000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter310000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter320000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter330000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter340000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter350000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter360000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter370000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter380000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter390000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter40000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter400000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter410000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter420000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter430000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter440000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter450000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter460000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter470000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter480000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter490000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter50000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter500000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter510000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter520000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter530000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter540000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter550000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter560000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter570000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter580000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter590000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter60000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter600000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter610000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter620000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter630000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter640000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter70000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter80000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/scores/model.iter90000.npz.bleu create mode 100644 ZadanieDomowe1/labs04/task05.py diff --git a/.idea/Python2018.iml b/.idea/Python2018.iml index 6711606..cdfe753 100644 --- a/.idea/Python2018.iml +++ b/.idea/Python2018.iml @@ -2,7 +2,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index 377499f..9fbf1f1 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..bf93761 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1528000731222 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ZadanieDomowe1/labs02/task07.py b/ZadanieDomowe1/labs02/task07.py new file mode 100644 index 0000000..64c890d --- /dev/null +++ b/ZadanieDomowe1/labs02/task07.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Napisz funkcję char_sum, która dla zadanego łańcucha zwraca +sumę kodów ASCII znaków. +""" + +""" +ord() - kod ASCII dla jednego znaku +print(ord('a')) +""" + +def char_sum(text): + suma_ascii = 0 # zerujemy (needto?) + for znak in text: + suma_ascii += ord(znak) # suma_ascii = ord(x) + suma_ascii + return suma_ascii + + +def tests(f): + inputs = [["this is a string"], ["this is another string"]] + outputs = [1516, 2172] + + for input, output in zip(inputs, outputs): + if f(*input) != output: + return "ERROR: {}!={}".format(f(*input), output) + break + return "TESTS PASSED" + +if __name__ == "__main__": + print(tests(char_sum)) diff --git a/ZadanieDomowe1/labs02/task08.py b/ZadanieDomowe1/labs02/task08.py new file mode 100644 index 0000000..1a092ea --- /dev/null +++ b/ZadanieDomowe1/labs02/task08.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Napisz funkcję sum_div35(n), która zwraca sumę wszystkich liczb podzielnych +przez 3 lub 5 mniejszych niż n. +""" + +def sum_div35(n): + suma = 0 + for liczba in range(1,n): # range(1,n) przedzial liczb mniejszych niz n + if liczba % 3 == 0: + suma += liczba + elif liczba % 5 == 0: + suma += liczba + return suma + + +def tests(f): + inputs = [[10], [100], [3845]] + outputs = [23, 2318, 3446403] + + for input, output in zip(inputs, outputs): + if f(*input) != output: + return "ERROR: {}!={}".format(f(*input), output) + break + return "TESTS PASSED" + +if __name__ == "__main__": + print(tests(sum_div35)) + diff --git a/ZadanieDomowe1/labs02/task09.py b/ZadanieDomowe1/labs02/task09.py new file mode 100644 index 0000000..6acc2df --- /dev/null +++ b/ZadanieDomowe1/labs02/task09.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Napisz funkcję leet_speak, która podmienia w podanym napisie niektóre litery +na podobnie wyglądające cyfry: 'e' na '3', 'l' na '1', 'o' na '0', 't' na '7'. +Np. leet('leet') powinno zwrócić '1337'. +""" + + +def leet_speak(text): + return text.replace('e', '3').replace('l', '1').replace('o', '0').replace('t', '7') + + +def tests(f): + inputs = [['leet'], ['do not want']] + outputs = ['1337', 'd0 n07 wan7'] + + for input, output in zip(inputs, outputs): + if f(*input) != output: + return "ERROR: {}!={}".format(f(*input), output) + break + return "TESTS PASSED" + +if __name__ == "__main__": + print(tests(leet_speak)) diff --git a/ZadanieDomowe1/labs02/task10.py b/ZadanieDomowe1/labs02/task10.py new file mode 100644 index 0000000..4ca46f8 --- /dev/null +++ b/ZadanieDomowe1/labs02/task10.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + + +""" +Napisz funkcję pokemon_speak, która zamienia w podanym napisie co drugą literę +na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'. +""" + + +def pokemon_speak(text): + pokemon = '' + capitalize = True + for litera in text: + if capitalize is True: + pokemon += litera.upper() + else: + pokemon += litera + capitalize = not capitalize + return pokemon + +""" +test + +print(pokemon_speak('tekst pisany malymi literami')) +""" + + +def tests(f): + inputs = [['pokemon'], ['do not want'], ['POKEMON']] + outputs = ['PoKeMoN', 'Do nOt wAnT', 'POKEMON'] + + for input, output in zip(inputs, outputs): + if f(*input) != output: + return "ERROR: {}!={}".format(f(*input), output) + break + return "TESTS PASSED" + +if __name__ == "__main__": + print(tests(pokemon_speak)) diff --git a/ZadanieDomowe1/labs02/task11.py b/ZadanieDomowe1/labs02/task11.py new file mode 100644 index 0000000..2cfda44 --- /dev/null +++ b/ZadanieDomowe1/labs02/task11.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + + +""" +Napisz funkcję common_chars(string1, string2), która zwraca alfabetycznie +uporządkowaną listę wspólnych liter z lańcuchów string1 i string2. +Oba napisy będą składać się wyłacznie z małych liter. +""" + +def common_chars(string1, string2): + + string1bezspacji = string1.replace(' ','') # trzeba spacje usunac + + string2bezspacji = string2.replace(' ','') + + return list(''.join(sorted(set(string1bezspacji) & set(string2bezspacji)))) + + + +def tests(f): + inputs = [["this is a string", "ala ma kota"]] + outputs = [['a', 't']] + + for input, output in zip(inputs, outputs): + if f(*input) != output: + return "ERROR: {}!={}".format(f(*input), output) + break + return "TESTS PASSED" + +if __name__ == "__main__": + print(tests(common_chars)) diff --git a/ZadanieDomowe1/labs04/README.md b/ZadanieDomowe1/labs04/README.md new file mode 100644 index 0000000..1a06df2 --- /dev/null +++ b/ZadanieDomowe1/labs04/README.md @@ -0,0 +1,34 @@ +# Laboratoria 4 + +## Zadania + +**ćwiczenie 0** NIE TRZEBA ROBIC!!!! +Uruchom programy z katalogu `examples` i zobacz ich kod. Spróbuj odgadnąć, co robią konkretne linie w kodzie. + +**ćwiczenie 1** NIE TRZEBA ROBIC!!!! +Każdy obiekt w Pythonie na wbudowaną funkcję ``id()``, która zwraca liczbę, która jest unikatowa i stała dla obiektu. Pozwala ona w prosty sposób sprawdzić, który obiekt jest *mutable*a, który *immutable*: jeżeli po wykonaniu operacji, zwracana liczba jest stała, to oznacza, że obiekt jest *mutable*. Sprawdź zachowanie funkcji na obiektach typy: + * lista, + * napis (string), + * liczba zmiennoprzecinkowa. + +**ćwiczenie 2** NIE TRZEBA ROBIC!!!! +Napisz generator, który będzie zwracać ``n`` kolejnych liczb ciągu Fibonacciego (``F(0)=1, F(1)=1, FN=F(N-1) + F(N-2)``). + +**ćwiczenie 3** NIE TRZEBA ROBIC!!!! +Strona ``https://api.fixer.io/latest`` udostępnia kursy różnych walut w stosunku do euro. Napisz skrypt, który: + * pobierze zawartość JSONa. Wykorzystaj bibliotekę ``requests`` (http://docs.python-requests.org/en/master/). + * korzystając z biblioteki ``json`` przekształć go do obiektu typu JSON. + * Wyświetl wartość kursu EUR do PLN. + +**ćwiczenie 4** NIE TRZEBA ROBIC!!!! +Zainstaluj bibliotekę ``weather-api`` (https://pypi.python.org/pypi/weather-api). Korzystając z niej: + * Wypisz informacje o aktualnej pogodzie. + * Napisz funkcję, która zamieni stopnie ``F`` na ``C``. + * Korzystając z prognozy, znajdź dzień, w którym będzie najzimniej. Wypisz nazwę tygodnia (w języku polskim) i temperaturę w C. + +**ćwiczenie 5** TRZEBA ZROBIĆ JAKO ZADANIE DOMOWE!!! +Katalog scores zawiera 64 pliki tekstowe, które posiadają informacje o wysokości miary ``BLEU`` na różnych etapach trenowania modelu. Nazwa każdego pliku na postać ``model.iterXXXXXXX.npz.bleu``, gdzie ``XXXXXXX``, to liczba iteracji.Zawartość każdego pliku jest podobna i ma następującą formę: *BLEU = YY.YY, 44.4/18.5/9.3/5.0 (BP=1.000, ratio=1.072, hyp_len=45976, ref_len=42903)*, gdzie ``YY.YY`` to wartość miary ``BLEU``. Znajdź plik, który zawiera najwyższą wartość miary ``BLEU``. + * Wykorzystaj bibliotekę ``glob`` (https://docs.python.org/2/library/glob.html) + * Wyświetl tylko pełną nazwe pliku (wraz z ścieżką). + +Cwiczenie 5 zrobić do 2.06.2018 nawet do 5 w nocy. \ No newline at end of file diff --git a/ZadanieDomowe1/labs04/examples/06_execution_time.py b/ZadanieDomowe1/labs04/examples/06_execution_time.py new file mode 100644 index 0000000..7fa34a7 --- /dev/null +++ b/ZadanieDomowe1/labs04/examples/06_execution_time.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +ExecutionTime + +This class is used for timing execution of code. + +For example: + + timer = ExecutionTime() + print 'Hello world!' + print 'Finished in {} seconds.'.format(timer.duration()) + +""" + + +import time +import random + + +class ExecutionTime: + def __init__(self): + self.start_time = time.time() + + def duration(self): + return time.time() - self.start_time + + +# ---- run code ---- # + + +timer = ExecutionTime() +sample_list = list() +my_list = [random.randint(1, 888898) for num in + range(1, 1000000) if num % 2 == 0] +print('Finished in {} seconds.'.format(timer.duration())) diff --git a/ZadanieDomowe1/labs04/examples/25_ip2geolocation.py b/ZadanieDomowe1/labs04/examples/25_ip2geolocation.py new file mode 100644 index 0000000..89ab872 --- /dev/null +++ b/ZadanieDomowe1/labs04/examples/25_ip2geolocation.py @@ -0,0 +1,31 @@ +import csv +import requests + + +def get_address(): + """ + Given a CSV file, this function returns a list of lists + where each element (list) in the outer list contains the + row info from the csv file. + """ + all_addresses = [requests.get('http://ip.42.pl/raw').text.strip()] + return all_addresses + + +def get_geolocation(ip_address): + """ + Given a list of lists from `get_addresses()`, this function + returns an updated lists of lists containing the geolocation. + """ + print("Getting geo information...") + # update header + # get geolocation + for line in all_the_ip_address: + print("Grabbing geo info") + r = requests.get('https://freegeoip.net/json/{0}'.format(line)) + print([str(r.json()['country_name']), str(r.json()['city'])]) + + +if __name__ == '__main__': + all_the_ip_address = get_address() + get_geolocation(all_the_ip_address) diff --git a/ZadanieDomowe1/labs04/examples/fib.py b/ZadanieDomowe1/labs04/examples/fib.py new file mode 100644 index 0000000..5cf8223 --- /dev/null +++ b/ZadanieDomowe1/labs04/examples/fib.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Obliczenie n-tego wyrazu ciągu fibonacciego na dwa sposoby. +1. Naiwna rekurencja: podstawienie do wzoru. +2. Wersja z cachem: każdy wyraz jest obliczany dokładnie raz. +""" + +def naive_fibonacci(n): + if n <= 0: + return 0 + if n in [1,2]: + return 1 + return naive_fibonacci(n-1) + naive_fibonacci(n-2) + + +def cache_fibonacci(n, cache=None): + if cache is None: + cache = [None for i in range(n+1)] + cache[0] = 0 + cache[1] = cache[2] = 1 + return cache_fibonacci(n, cache) + else: + if cache[n] is not None: + return cache[n] + else: + cache[n] = cache_fibonacci(n-1, cache) + cache_fibonacci(n-2, cache) + return cache[n] + +def non_reccurent_fibonacci(n): + cache = [None for i in range(n+1)] + cache[0] = 0 + cache[1] = cache[2] = 1 + for i in range(2, n + 1): + cache[i] = cache[i-1] + cache[i-2] + return cache[n] + +for i in [5, 10, 15, 20, 30, 40]: + print("Naive fibonacci for ", i, ":", naive_fibonacci(i)) + +for i in [5, 10, 15, 20, 30, 40, 100]: + print("cache fibonacci for ", i, ":", cache_fibonacci(i)) + +for i in [5, 10, 15, 20, 30, 40, 100]: + print("no-recurrent fibonacci for ", i, ":", non_reccurent_fibonacci(i)) + diff --git a/ZadanieDomowe1/labs04/examples/myip.py b/ZadanieDomowe1/labs04/examples/myip.py new file mode 100644 index 0000000..14013ac --- /dev/null +++ b/ZadanieDomowe1/labs04/examples/myip.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +""" +This simple script fetches your IP as seen by web pages, and displays it. + +Execute this script locally like that: +$ curl -s https://raw.github.com/gist/3389407/myip.py | python +""" +import requests + +print(requests.get('http://ip.42.pl/raw').text) diff --git a/ZadanieDomowe1/labs04/examples/wc.py b/ZadanieDomowe1/labs04/examples/wc.py new file mode 100644 index 0000000..4dfc78c --- /dev/null +++ b/ZadanieDomowe1/labs04/examples/wc.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Implementacja narzedzia ``wc`` z linuksa (word counter). +Zwraca liczbę słów, znaków i linii. +""" + +import sys + + +def count_lines(text): + """ return number of lines. """ + return len(text.strip().split('\n')) + +def count_words(text): + """ return number of words. """ + return sum([len([1 for word in line.split(' ') if len(word)]) + for line in text.split('\n')]) + +def count_chars(text): + """ return number of words. """ + return len(text) + +def wc(text): + """ proper wc """ + lines = count_lines(text) + words = count_words(text) + chars = count_chars(text) + return lines, words, chars + + +def main(): + """ main """ + print(wc(sys.stdin.read())) + + +if __name__ == "__main__": + main() diff --git a/ZadanieDomowe1/labs04/haslo.txt b/ZadanieDomowe1/labs04/haslo.txt new file mode 100644 index 0000000..f269661 --- /dev/null +++ b/ZadanieDomowe1/labs04/haslo.txt @@ -0,0 +1,2 @@ +W Paryżu najlepsze kasztany są na placu Pigalle +Zuzanna lubi je tylko jesienią. diff --git a/ZadanieDomowe1/labs04/haslo2.txt b/ZadanieDomowe1/labs04/haslo2.txt new file mode 100644 index 0000000..0bbe445 --- /dev/null +++ b/ZadanieDomowe1/labs04/haslo2.txt @@ -0,0 +1 @@ +corect horse battery staple \ No newline at end of file diff --git a/ZadanieDomowe1/labs04/scores/model.iter10000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter10000.npz.bleu new file mode 100644 index 0000000..8eba4ec --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter10000.npz.bleu @@ -0,0 +1 @@ +BLEU = 2.02, 17.1/3.6/1.0/0.3 (BP=1.000, ratio=1.872, hyp_len=80326, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter100000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter100000.npz.bleu new file mode 100644 index 0000000..c8c380c --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter100000.npz.bleu @@ -0,0 +1 @@ +BLEU = 13.99, 44.4/18.5/9.3/5.0 (BP=1.000, ratio=1.072, hyp_len=45976, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter110000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter110000.npz.bleu new file mode 100644 index 0000000..dcbf8a8 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter110000.npz.bleu @@ -0,0 +1 @@ +BLEU = 14.35, 44.9/19.0/9.6/5.2 (BP=1.000, ratio=1.087, hyp_len=46657, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter120000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter120000.npz.bleu new file mode 100644 index 0000000..c7607bb --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter120000.npz.bleu @@ -0,0 +1 @@ +BLEU = 15.75, 47.1/20.5/10.7/6.0 (BP=1.000, ratio=1.030, hyp_len=44211, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter130000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter130000.npz.bleu new file mode 100644 index 0000000..6ef614e --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter130000.npz.bleu @@ -0,0 +1 @@ +BLEU = 15.96, 47.7/20.8/10.9/6.0 (BP=1.000, ratio=1.029, hyp_len=44160, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter140000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter140000.npz.bleu new file mode 100644 index 0000000..55075dd --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter140000.npz.bleu @@ -0,0 +1 @@ +BLEU = 15.42, 46.8/20.3/10.5/5.7 (BP=1.000, ratio=1.043, hyp_len=44729, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter150000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter150000.npz.bleu new file mode 100644 index 0000000..f48a590 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter150000.npz.bleu @@ -0,0 +1 @@ +BLEU = 15.84, 47.3/20.7/10.8/5.9 (BP=1.000, ratio=1.034, hyp_len=44374, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter160000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter160000.npz.bleu new file mode 100644 index 0000000..74cf4bd --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter160000.npz.bleu @@ -0,0 +1 @@ +BLEU = 15.99, 47.7/20.8/10.9/6.0 (BP=1.000, ratio=1.031, hyp_len=44233, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter170000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter170000.npz.bleu new file mode 100644 index 0000000..4aa9072 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter170000.npz.bleu @@ -0,0 +1 @@ +BLEU = 16.15, 47.9/21.0/11.0/6.1 (BP=1.000, ratio=1.027, hyp_len=44065, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter180000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter180000.npz.bleu new file mode 100644 index 0000000..b4c3dfc --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter180000.npz.bleu @@ -0,0 +1 @@ +BLEU = 15.86, 47.1/20.8/10.8/6.0 (BP=1.000, ratio=1.053, hyp_len=45191, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter190000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter190000.npz.bleu new file mode 100644 index 0000000..d4472dc --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter190000.npz.bleu @@ -0,0 +1 @@ +BLEU = 16.07, 47.7/21.0/11.0/6.0 (BP=1.000, ratio=1.044, hyp_len=44795, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter20000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter20000.npz.bleu new file mode 100644 index 0000000..4bf5ed1 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter20000.npz.bleu @@ -0,0 +1 @@ +BLEU = 5.87, 31.1/8.9/3.3/1.3 (BP=1.000, ratio=1.155, hyp_len=49533, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter200000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter200000.npz.bleu new file mode 100644 index 0000000..b88ce22 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter200000.npz.bleu @@ -0,0 +1 @@ +BLEU = 16.82, 48.9/21.7/11.5/6.6 (BP=0.998, ratio=0.998, hyp_len=42837, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter210000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter210000.npz.bleu new file mode 100644 index 0000000..6c71702 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter210000.npz.bleu @@ -0,0 +1 @@ +BLEU = 16.70, 48.7/21.7/11.5/6.4 (BP=1.000, ratio=1.017, hyp_len=43622, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter220000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter220000.npz.bleu new file mode 100644 index 0000000..e37a581 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter220000.npz.bleu @@ -0,0 +1 @@ +BLEU = 16.85, 48.9/21.9/11.7/6.5 (BP=1.000, ratio=1.020, hyp_len=43777, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter230000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter230000.npz.bleu new file mode 100644 index 0000000..4a74673 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter230000.npz.bleu @@ -0,0 +1 @@ +BLEU = 16.59, 48.3/21.6/11.4/6.3 (BP=1.000, ratio=1.029, hyp_len=44127, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter240000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter240000.npz.bleu new file mode 100644 index 0000000..7c60d8e --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter240000.npz.bleu @@ -0,0 +1 @@ +BLEU = 16.94, 48.6/22.0/11.7/6.6 (BP=1.000, ratio=1.038, hyp_len=44517, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter250000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter250000.npz.bleu new file mode 100644 index 0000000..5e047b6 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter250000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.52, 49.7/22.5/12.2/6.9 (BP=1.000, ratio=1.003, hyp_len=43053, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter260000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter260000.npz.bleu new file mode 100644 index 0000000..d5d6814 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter260000.npz.bleu @@ -0,0 +1 @@ +BLEU = 16.82, 48.6/21.9/11.6/6.5 (BP=1.000, ratio=1.037, hyp_len=44475, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter270000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter270000.npz.bleu new file mode 100644 index 0000000..e6ed040 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter270000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.16, 49.2/22.3/11.9/6.6 (BP=1.000, ratio=1.025, hyp_len=43965, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter280000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter280000.npz.bleu new file mode 100644 index 0000000..9a5b8fc --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter280000.npz.bleu @@ -0,0 +1 @@ +BLEU = 16.92, 49.4/22.1/11.7/6.4 (BP=1.000, ratio=1.013, hyp_len=43453, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter290000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter290000.npz.bleu new file mode 100644 index 0000000..ea460d2 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter290000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.20, 49.2/22.1/11.9/6.8 (BP=1.000, ratio=1.016, hyp_len=43578, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter30000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter30000.npz.bleu new file mode 100644 index 0000000..beca2c8 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter30000.npz.bleu @@ -0,0 +1 @@ +BLEU = 8.17, 33.9/11.6/5.0/2.3 (BP=1.000, ratio=1.207, hyp_len=51768, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter300000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter300000.npz.bleu new file mode 100644 index 0000000..22adb3d --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter300000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.31, 49.2/22.2/12.0/6.8 (BP=1.000, ratio=1.017, hyp_len=43642, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter310000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter310000.npz.bleu new file mode 100644 index 0000000..e540729 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter310000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.57, 49.5/22.5/12.3/7.0 (BP=1.000, ratio=1.000, hyp_len=42900, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter320000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter320000.npz.bleu new file mode 100644 index 0000000..fa27e8b --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter320000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.68, 49.6/22.6/12.3/7.1 (BP=1.000, ratio=1.013, hyp_len=43465, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter330000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter330000.npz.bleu new file mode 100644 index 0000000..9647a15 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter330000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.02, 48.3/21.9/11.8/6.7 (BP=1.000, ratio=1.044, hyp_len=44801, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter340000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter340000.npz.bleu new file mode 100644 index 0000000..784fe91 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter340000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.51, 49.7/22.7/12.2/6.9 (BP=1.000, ratio=1.011, hyp_len=43368, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter350000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter350000.npz.bleu new file mode 100644 index 0000000..553eb3f --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter350000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.68, 50.3/22.9/12.4/7.0 (BP=0.995, ratio=0.995, hyp_len=42702, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter360000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter360000.npz.bleu new file mode 100644 index 0000000..5318e68 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter360000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.43, 49.0/22.4/12.2/6.9 (BP=1.000, ratio=1.040, hyp_len=44629, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter370000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter370000.npz.bleu new file mode 100644 index 0000000..7cebde9 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter370000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.16, 49.2/22.2/11.9/6.7 (BP=1.000, ratio=1.028, hyp_len=44085, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter380000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter380000.npz.bleu new file mode 100644 index 0000000..59e8c47 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter380000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.04, 49.1/22.2/11.8/6.6 (BP=1.000, ratio=1.030, hyp_len=44200, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter390000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter390000.npz.bleu new file mode 100644 index 0000000..b98b614 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter390000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.77, 49.8/22.8/12.4/7.1 (BP=1.000, ratio=1.008, hyp_len=43258, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter40000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter40000.npz.bleu new file mode 100644 index 0000000..f6a3781 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter40000.npz.bleu @@ -0,0 +1 @@ +BLEU = 8.55, 32.5/11.9/5.3/2.6 (BP=1.000, ratio=1.341, hyp_len=57542, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter400000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter400000.npz.bleu new file mode 100644 index 0000000..a1b2236 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter400000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.96, 50.0/23.0/12.6/7.2 (BP=1.000, ratio=1.002, hyp_len=43009, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter410000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter410000.npz.bleu new file mode 100644 index 0000000..1f72abd --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter410000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.66, 49.6/22.6/12.3/7.0 (BP=1.000, ratio=1.019, hyp_len=43697, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter420000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter420000.npz.bleu new file mode 100644 index 0000000..05c904e --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter420000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.93, 49.8/23.1/12.6/7.2 (BP=1.000, ratio=1.021, hyp_len=43824, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter430000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter430000.npz.bleu new file mode 100644 index 0000000..9d0ddc0 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter430000.npz.bleu @@ -0,0 +1 @@ +BLEU = 16.55, 47.0/21.3/11.5/6.5 (BP=1.000, ratio=1.071, hyp_len=45947, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter440000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter440000.npz.bleu new file mode 100644 index 0000000..fc24017 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter440000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.59, 49.8/22.7/12.2/6.9 (BP=1.000, ratio=1.009, hyp_len=43301, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter450000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter450000.npz.bleu new file mode 100644 index 0000000..6f284b8 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter450000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.41, 49.2/22.5/12.1/6.9 (BP=1.000, ratio=1.023, hyp_len=43894, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter460000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter460000.npz.bleu new file mode 100644 index 0000000..71fb5a1 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter460000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.52, 49.9/22.7/12.2/6.8 (BP=1.000, ratio=1.005, hyp_len=43127, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter470000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter470000.npz.bleu new file mode 100644 index 0000000..c70f06f --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter470000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.30, 49.1/22.3/12.0/6.8 (BP=1.000, ratio=1.024, hyp_len=43917, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter480000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter480000.npz.bleu new file mode 100644 index 0000000..d5d65f7 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter480000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.21, 48.8/22.1/12.0/6.8 (BP=1.000, ratio=1.036, hyp_len=44454, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter490000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter490000.npz.bleu new file mode 100644 index 0000000..aed4444 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter490000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.79, 50.0/22.9/12.4/7.1 (BP=1.000, ratio=1.000, hyp_len=42891, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter50000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter50000.npz.bleu new file mode 100644 index 0000000..5455567 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter50000.npz.bleu @@ -0,0 +1 @@ +BLEU = 11.03, 39.5/15.1/7.1/3.5 (BP=1.000, ratio=1.116, hyp_len=47860, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter500000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter500000.npz.bleu new file mode 100644 index 0000000..7744912 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter500000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.25, 49.4/22.3/12.0/6.7 (BP=1.000, ratio=1.014, hyp_len=43517, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter510000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter510000.npz.bleu new file mode 100644 index 0000000..7a94c57 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter510000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.78, 50.0/22.8/12.4/7.1 (BP=1.000, ratio=1.000, hyp_len=42890, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter520000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter520000.npz.bleu new file mode 100644 index 0000000..4f622dd --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter520000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.68, 49.8/22.7/12.4/7.0 (BP=1.000, ratio=1.003, hyp_len=43021, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter530000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter530000.npz.bleu new file mode 100644 index 0000000..d538c9b --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter530000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.31, 48.9/22.3/12.1/6.8 (BP=1.000, ratio=1.032, hyp_len=44262, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter540000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter540000.npz.bleu new file mode 100644 index 0000000..48cdef1 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter540000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.92, 49.8/22.9/12.5/7.2 (BP=1.000, ratio=1.015, hyp_len=43562, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter550000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter550000.npz.bleu new file mode 100644 index 0000000..8dc8838 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter550000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.84, 50.0/22.9/12.5/7.1 (BP=1.000, ratio=1.011, hyp_len=43389, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter560000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter560000.npz.bleu new file mode 100644 index 0000000..85e0ef3 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter560000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.75, 49.8/22.8/12.4/7.1 (BP=1.000, ratio=1.014, hyp_len=43494, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter570000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter570000.npz.bleu new file mode 100644 index 0000000..0849629 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter570000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.94, 50.0/23.1/12.6/7.1 (BP=1.000, ratio=1.013, hyp_len=43442, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter580000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter580000.npz.bleu new file mode 100644 index 0000000..b0d5a26 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter580000.npz.bleu @@ -0,0 +1 @@ +BLEU = 18.12, 50.3/23.1/12.7/7.3 (BP=1.000, ratio=1.004, hyp_len=43077, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter590000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter590000.npz.bleu new file mode 100644 index 0000000..afcf0ba --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter590000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.29, 48.8/22.3/12.1/6.8 (BP=1.000, ratio=1.042, hyp_len=44688, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter60000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter60000.npz.bleu new file mode 100644 index 0000000..1956b32 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter60000.npz.bleu @@ -0,0 +1 @@ +BLEU = 11.92, 40.2/16.1/7.8/4.0 (BP=1.000, ratio=1.144, hyp_len=49071, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter600000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter600000.npz.bleu new file mode 100644 index 0000000..a680910 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter600000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.46, 49.5/22.5/12.2/6.8 (BP=1.000, ratio=1.026, hyp_len=44035, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter610000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter610000.npz.bleu new file mode 100644 index 0000000..6e55d7b --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter610000.npz.bleu @@ -0,0 +1 @@ +BLEU = 18.19, 50.3/23.2/12.7/7.4 (BP=1.000, ratio=1.007, hyp_len=43221, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter620000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter620000.npz.bleu new file mode 100644 index 0000000..af92c95 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter620000.npz.bleu @@ -0,0 +1 @@ +BLEU = 17.84, 50.1/22.9/12.5/7.1 (BP=1.000, ratio=1.016, hyp_len=43604, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter630000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter630000.npz.bleu new file mode 100644 index 0000000..26ef4b9 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter630000.npz.bleu @@ -0,0 +1 @@ +BLEU = 18.30, 50.8/23.4/12.9/7.5 (BP=0.994, ratio=0.994, hyp_len=42632, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter640000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter640000.npz.bleu new file mode 100644 index 0000000..c1b857c --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter640000.npz.bleu @@ -0,0 +1 @@ +BLEU = 0, 0/0/0/0 (BP=0, ratio=0, hyp_len=0, ref_len=0) diff --git a/ZadanieDomowe1/labs04/scores/model.iter70000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter70000.npz.bleu new file mode 100644 index 0000000..a4232f5 --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter70000.npz.bleu @@ -0,0 +1 @@ +BLEU = 12.77, 42.4/17.1/8.4/4.4 (BP=1.000, ratio=1.096, hyp_len=47008, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter80000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter80000.npz.bleu new file mode 100644 index 0000000..ed8edfa --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter80000.npz.bleu @@ -0,0 +1 @@ +BLEU = 14.43, 46.7/19.4/9.7/5.2 (BP=0.988, ratio=0.988, hyp_len=42376, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/scores/model.iter90000.npz.bleu b/ZadanieDomowe1/labs04/scores/model.iter90000.npz.bleu new file mode 100644 index 0000000..cd456bf --- /dev/null +++ b/ZadanieDomowe1/labs04/scores/model.iter90000.npz.bleu @@ -0,0 +1 @@ +BLEU = 13.85, 44.1/18.5/9.2/4.9 (BP=1.000, ratio=1.092, hyp_len=46859, ref_len=42903) diff --git a/ZadanieDomowe1/labs04/task05.py b/ZadanieDomowe1/labs04/task05.py new file mode 100644 index 0000000..b930242 --- /dev/null +++ b/ZadanieDomowe1/labs04/task05.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +**ćwiczenie 5** +Katalog scores zawiera 64 pliki tekstowe, które posiadają informacje o wysokości miary ``BLEU`` na różnych etapach trenowania modelu. Nazwa każdego pliku na postać ``model.iterXXXXXXX.npz.bleu``, gdzie ``XXXXXXX``, to liczba iteracji.Zawartość każdego pliku jest podobna i ma następującą formę: *BLEU = YY.YY, 44.4/18.5/9.3/5.0 (BP=1.000, ratio=1.072, hyp_len=45976, ref_len=42903)*, gdzie ``YY.YY`` to wartość miary ``BLEU``. Znajdź plik, który zawiera najwyższą wartość miary ``BLEU``. + * Wykorzystaj bibliotekę ``glob`` (https://docs.python.org/2/library/glob.html) + * Wyświetl tylko pełną nazwe pliku (wraz z ścieżką). +""" + +import glob as gl +import pandas as pd \ No newline at end of file