diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2014-07-29 18:50:09 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2014-07-29 18:50:09 -0400 |
| commit | 2ab5da4bfdce9f41e93a27082900da6ea72db6ed (patch) | |
| tree | bdbe27d77fea5f77e0b6a8934ab01391f03a8057 /web/utils.py | |
| parent | dfcd65c8f10aa94f19fe40940565681ab9a73e44 (diff) | |
| download | ocr-layer-curation-2ab5da4bfdce9f41e93a27082900da6ea72db6ed.tar.gz | |
Webapp now show three columns
image, original text and corrected text. The highlighting is functional
as well.
Diffstat (limited to 'web/utils.py')
| -rw-r--r-- | web/utils.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/web/utils.py b/web/utils.py index 8522841..71a5048 100644 --- a/web/utils.py +++ b/web/utils.py @@ -10,12 +10,12 @@ def gen_html(book, page_number): corrected_text = get_page(book, int(page_number)) corrected_words = su.simplify(corrected_text).split() if d: - words, coords = zip(*d) - C = su.align(corrected_words, list(words), list(coords)) - r = su.alignment_to_sexp(corrected_text.split(), words, coords, C[1]) - corrected_words, coords = zip(*r) - coords_html = du.convert_to_htmlcoord(coords, page.size[1]) - return (list(enumerate(coords_html)), list(enumerate(corrected_words))) + orig_words, orig_coords = zip(*d) + C = su.align(corrected_words, list(orig_words), list(orig_coords)) + r = su.alignment_to_coord(corrected_text.split(), C[1]) + corr_words, corr_coords_index = zip(*r) + orig_coords_html = du.convert_to_htmlcoord(orig_coords, page.size[1]) + return orig_coords_html, orig_words, corr_coords_index, corr_words if __name__ == "__main__": gen_html(*sys.argv[1:3]) |
