Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert confidence percent to fraction #19

Merged
merged 5 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/test_workspace.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path
from os import chdir
from difflib import unified_diff
from unittest import TestCase, skip, main
from tempfile import NamedTemporaryFile
from ocrd_models.ocrd_page import parseEtree
Expand Down Expand Up @@ -63,4 +64,6 @@ def test_api(self):
},
)
del tar_img_path_elem.attrib["imageFilename"]
assert ET.tostring(target_tree) == ET.tostring(result_tree)
assert ET.tostring(target_tree) == ET.tostring(result_tree), unified_diff(
ET.tostring(target_tree, pretty_print=True, encoding='UTF-8'),
ET.tostring(result_tree, pretty_print=True, encoding='UTF-8'))
8 changes: 4 additions & 4 deletions textract2page/convert_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def convert_file(
if line.text:
pagexml_text_line.add_TextEquiv(
TextEquivType(
conf=line.confidence,
conf=line.confidence / 100,
Unicode=line.text)
)
pagexml_text_region_line.add_TextLine(pagexml_text_line)
Expand All @@ -723,7 +723,7 @@ def convert_file(
)
if word.text:
pagexml_word.add_TextEquiv(TextEquivType(
conf=word.confidence,
conf=word.confidence / 100,
Unicode=word.text))
pagexml_text_line.add_Word(pagexml_word)

Expand Down Expand Up @@ -806,7 +806,7 @@ def convert_file(
if line.text:
pagexml_text_line.add_TextEquiv(
TextEquivType(
conf=line.confidence,
conf=line.confidence / 100,
Unicode=line.text)
)
pagexml_cell_region.add_TextLine(pagexml_text_line)
Expand All @@ -824,7 +824,7 @@ def convert_file(
if word.text:
pagexml_word.add_TextEquiv(
TextEquivType(
conf=word.confidence,
conf=word.confidence / 100,
Unicode=word.text)
)
pagexml_text_line.add_Word(pagexml_word)
Expand Down
Loading