-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest_recognize.py
32 lines (25 loc) · 962 Bytes
/
test_recognize.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# pylint: disable=import-error
import os
import shutil
from tests.base import TestCase, assets, main
from ocrd import Resolver, run_processor
from ocrd_utils import initLogging, pushd_popd
from ocrd_kraken.recognize import KrakenRecognize
class TestKrakenRecognize(TestCase):
def setUp(self):
initLogging()
def test_recognize(self):
resolver = Resolver()
# with pushd_popd('/tmp/kraken-test') as tempdir:
with pushd_popd(tempdir=True) as tempdir:
workspace = resolver.workspace_from_url(assets.path_to('communist_manifesto/data/mets.xml'), dst_dir=tempdir, download=True)
workspace.overwrite_mode = True
proc = KrakenRecognize(
workspace,
input_file_grp="OCR-D-SEG-KRAKEN",
output_file_grp="OCR-D-OCR-KRAKEN",
)
proc.process()
workspace.save_mets()
if __name__ == "__main__":
main(__file__)