|
|
@ -1,6 +1,7 @@
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import shutil
|
|
|
|
import json
|
|
|
|
import json
|
|
|
|
|
|
|
|
import sys
|
|
|
|
from pathlib import Path
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
from click.testing import CliRunner
|
|
|
|
from click.testing import CliRunner
|
|
|
@ -23,11 +24,13 @@ def test_ocrd_cli(tmp_path):
|
|
|
|
# Run through the OCR-D interface
|
|
|
|
# Run through the OCR-D interface
|
|
|
|
with working_directory(str(test_workspace_dir)):
|
|
|
|
with working_directory(str(test_workspace_dir)):
|
|
|
|
runner = CliRunner()
|
|
|
|
runner = CliRunner()
|
|
|
|
result = runner.invoke(ocrd_dinglehopper, [
|
|
|
|
args = [
|
|
|
|
'-m', 'mets.xml',
|
|
|
|
'-m', 'mets.xml',
|
|
|
|
'-I', 'OCR-D-GT-PAGE,OCR-D-OCR-CALAMARI',
|
|
|
|
'-I', 'OCR-D-GT-PAGE,OCR-D-OCR-CALAMARI',
|
|
|
|
'-O', 'OCR-D-OCR-CALAMARI-EVAL'
|
|
|
|
'-O', 'OCR-D-OCR-CALAMARI-EVAL'
|
|
|
|
])
|
|
|
|
]
|
|
|
|
|
|
|
|
sys.argv[1:] = args # XXX Hack to satisfy ocrd_cli_wrap_processor() check for arguments
|
|
|
|
|
|
|
|
result = runner.invoke(ocrd_dinglehopper, args)
|
|
|
|
assert result.exit_code == 0
|
|
|
|
assert result.exit_code == 0
|
|
|
|
result_json = list((test_workspace_dir / 'OCR-D-OCR-CALAMARI-EVAL').glob('*.json'))
|
|
|
|
result_json = list((test_workspace_dir / 'OCR-D-OCR-CALAMARI-EVAL').glob('*.json'))
|
|
|
|
assert json.load(open(str(result_json[0])))['cer'] < 0.03
|
|
|
|
assert json.load(open(str(result_json[0])))['cer'] < 0.03
|
|
|
|