aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2014-02-27 11:29:28 -0500
committerThibaut Horel <thibaut.horel@gmail.com>2014-02-27 11:29:28 -0500
commit31ca595e875dd4e2cb07b2d3610b0d4b4f590abe (patch)
tree205ec06d52ef1d2d13a94543cba170119748a945
parentb8013d90c16cf4e1225205fc309f24f7c06ea6c5 (diff)
downloadocr-layer-curation-31ca595e875dd4e2cb07b2d3610b0d4b4f590abe.tar.gz
PEP8
-rw-r--r--compare.py6
-rw-r--r--wikisource.py7
2 files changed, 7 insertions, 6 deletions
diff --git a/compare.py b/compare.py
index b6a4c8a..5f2352b 100644
--- a/compare.py
+++ b/compare.py
@@ -15,7 +15,7 @@ l2 = get_page(wikibook, n)
print len(l2.split())
l3 = su.simplify(l2)
C = su.align(l3.split(), l1, c1)
-pdb.set_trace()
-sexp = page_sexp(wikibook, n)
-su.alignment_to_sexp(C[1], sexp, l2.split())
+#pdb.set_trace()
+#sexp = page_sexp(wikibook, n)
+#su.alignment_to_sexp(C[1], sexp, l2.split())
su.print_alignment(l2.split(), l1, c1, C[1])
diff --git a/wikisource.py b/wikisource.py
index 070c84a..1459468 100644
--- a/wikisource.py
+++ b/wikisource.py
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
import requests
-import lxml
import sys
from bs4 import BeautifulSoup
from itertools import takewhile, count
URL = "http://fr.wikisource.org/w/index.php"
+
def get_page(title, page):
- params = { "action": "render", "title": "Page:" + title + "/" + str(page) }
+ params = {"action": "render", "title": "Page:" + title + "/" + str(page)}
r = requests.get(URL, params=params)
if r.status_code == requests.codes.ok:
soup = BeautifulSoup(r.text, "lxml")
@@ -16,9 +16,10 @@ def get_page(title, page):
else:
return None
+
def get_pages(title, begin=1, end=None):
if end:
- return (get_page(title, i) for i in xrange(begin, end+1))
+ return (get_page(title, i) for i in xrange(begin, end + 1))
else:
return takewhile(lambda x: x is not None,
(get_page(title, i) for i in count(begin)))