aboutsummaryrefslogtreecommitdiffstats
path: root/compare.py
blob: 73055170a140f3115dc55e49e48c97afca05d387 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# -*- coding: utf-8 -*-

from wikisource import get_page
from parsedjvutext import parse_page_sexp
import string_utils as su

# wikibook = "Bloy - Le Sang du pauvre, Stock, 1932.djvu".replace(" ", "_")
wikibook = "Villiers de L'Isle-Adam - Tribulat Bonhomet, 1908.djvu".replace(" ", "_")

n = 88
ocrpage = parse_page_sexp(wikibook, n)
l1, c1 = ocrpage['words'], ocrpage["coords"]
l2 = get_page(wikibook, n)
l3 = su.simplify(l2)
C = su.align(l3.split(), l1, c1)
su.print_alignment(l2.split(), l1, c1, C[1])