2 # -*- coding: utf-8 -*-
3 # Copyright © 2011 Fundacja Nowoczesna Polska
5 # This file is part of Leśmianator.
7 # Leśmianator is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # Leśmianator is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with Leśmianator. If not, see <http://www.gnu.org/licenses/>.
22 Inicjalizuje bazę danych Leśmianatora z pobranych plików TXT.
24 Skrypt pobiera paczkę plików TXT z utworami lirycznymi
25 i przekazuje ich treść Leśmianatorowi do analizy.
29 from StringIO import StringIO
30 from urllib2 import urlopen
31 from zipfile import ZipFile
33 from lesmianator import Lesmianator
36 TXT_FILES = "http://www.wolnelektury.pl/media/packs/txt-liryka.zip"
39 if __name__ == '__main__':
40 txt_zip = ZipFile(StringIO(urlopen(TXT_FILES).read()))
43 for filename in txt_zip.namelist():
45 poet.add_txt_file(txt_zip.open(filename))