From 994c1c3587f7893ae2202a4f48314da931d26e0c Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Wed, 25 Apr 2018 16:22:26 +0200 Subject: [PATCH] rename from/to coordinate_string -> points --- ocrd/model/ocrd_xml_base.py | 8 ++++---- ocrd/utils.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ocrd/model/ocrd_xml_base.py b/ocrd/model/ocrd_xml_base.py index 4ae3a6a76..eaeee32bf 100644 --- a/ocrd/model/ocrd_xml_base.py +++ b/ocrd/model/ocrd_xml_base.py @@ -4,8 +4,8 @@ ) from ocrd.utils import ( xmllint_format, - xywh_from_coordinate_string, - coordinate_string_from_xywh + xywh_from_points, + points_from_xywh ) from lxml import etree as ET @@ -22,14 +22,14 @@ def get_coords(el): coords = el.find('page:Coords', NAMESPACES) if coords is not None: points = coords.get('points') - return xywh_from_coordinate_string(points) + return xywh_from_points(points) def set_coords(el, box): if box is not None: coords = el.find('page:Coords', NAMESPACES) if coords is None: coords = ET.SubElement(el, TAG_PAGE_COORDS) - coords.set("points", coordinate_string_from_xywh(box)) + coords.set("points", points_from_xywh(box)) class OcrdXmlDocument(object): diff --git a/ocrd/utils.py b/ocrd/utils.py index 168688707..6ae5df0ce 100644 --- a/ocrd/utils.py +++ b/ocrd/utils.py @@ -10,7 +10,7 @@ def getLogger(*args, **kwargs): return logging.getLogger(*args, **kwargs) -def coordinate_string_from_xywh(box): +def points_from_xywh(box): """ Constructs a polygon representation from a rectangle described as a dict with keys x, y, w, h. """ @@ -26,7 +26,7 @@ def coordinate_string_from_xywh(box): box['y'] + box['h'] ) -def xywh_from_coordinate_string(points): +def xywh_from_points(points): """ Constructs a numpy-compatible polygon from a page representation. """