Skip to content

Commit

Permalink
test_segment.py: use stable API
Browse files Browse the repository at this point in the history
  • Loading branch information
bertsky authored Aug 13, 2024
1 parent 340f513 commit cd0ce01
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions tests/test_segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from tests.base import TestCase, assets, main

from ocrd import Resolver
from ocrd import Resolver, run_processor
from ocrd_utils import initLogging, pushd_popd
from ocrd_kraken.segment import KrakenSegment

Expand All @@ -18,42 +18,45 @@ def test_run_blla(self):
resolver = Resolver()
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)
proc = KrakenSegment(
workspace,
run_processor(
KrakenSegment,
workspace=workspace,
input_file_grp="OCR-D-IMG-BIN",
output_file_grp="OCR-D-SEG-LINE-KRAKEN",
parameter={'maxcolseps': 0, 'use_legacy': False}
)
proc.process()
workspace.save_mets()
# FIXME: add result assertions (find_files, parsing PAGE etc)

def test_run_blla_regionlevel(self):
resolver = Resolver()
with pushd_popd(tempdir=True) as tempdir:
workspace = resolver.workspace_from_url(assets.path_to('kant_aufklaerung_1784-page-region/data/mets.xml'), dst_dir=tempdir, download=True)
proc = KrakenSegment(
workspace,
run_processor(
KrakenSegment,
workspace=workspace,
input_file_grp="OCR-D-GT-SEG-REGION",
output_file_grp="OCR-D-SEG-LINE-KRAKEN",
page_id="phys_0005",
parameter={'maxcolseps': 0, 'use_legacy': False}
)
proc.process()
workspace.save_mets()
# FIXME: add result assertions (find_files, parsing PAGE etc)

def test_run_legacy(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)
proc = KrakenSegment(
workspace,
run_processor(
KrakenSegment,
workspace=workspace,
input_file_grp="OCR-D-IMG-BIN",
output_file_grp="OCR-D-SEG-LINE-KRAKEN",
parameter={'maxcolseps': 0, 'use_legacy': True}
)
proc.process()
workspace.save_mets()
# FIXME: add result assertions (find_files, parsing PAGE etc)

if __name__ == "__main__":
main(__file__)

0 comments on commit cd0ce01

Please sign in to comment.