mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-06-09 11:50:00 +02:00
🎨 dinglehopper: s/LOG/log
This commit is contained in:
parent
0804b029c4
commit
31c63f9e4c
1 changed files with 4 additions and 4 deletions
|
@ -243,7 +243,7 @@ def get_textequiv_unicode(text_segment, nsmap) -> str:
|
||||||
|
|
||||||
def get_first_textequiv(textequivs, segment_id):
|
def get_first_textequiv(textequivs, segment_id):
|
||||||
"""Get the first TextEquiv based on index or conf order if index is not present."""
|
"""Get the first TextEquiv based on index or conf order if index is not present."""
|
||||||
LOG = getLogger('processor.OcrdDinglehopperEvaluate')
|
log = getLogger('processor.OcrdDinglehopperEvaluate')
|
||||||
if len(textequivs) == 1:
|
if len(textequivs) == 1:
|
||||||
return textequivs[0]
|
return textequivs[0]
|
||||||
|
|
||||||
|
@ -252,18 +252,18 @@ def get_first_textequiv(textequivs, segment_id):
|
||||||
nan_mask = np.isnan(indices)
|
nan_mask = np.isnan(indices)
|
||||||
if np.any(~nan_mask):
|
if np.any(~nan_mask):
|
||||||
if np.any(nan_mask):
|
if np.any(nan_mask):
|
||||||
LOG.warning("TextEquiv without index in %s.", segment_id)
|
log.warning("TextEquiv without index in %s.", segment_id)
|
||||||
index = np.nanargmin(indices)
|
index = np.nanargmin(indices)
|
||||||
else:
|
else:
|
||||||
# try ordering by conf
|
# try ordering by conf
|
||||||
confidences = np.array([get_attr(te, 'conf') for te in textequivs], dtype=float)
|
confidences = np.array([get_attr(te, 'conf') for te in textequivs], dtype=float)
|
||||||
if np.any(~np.isnan(confidences)):
|
if np.any(~np.isnan(confidences)):
|
||||||
LOG.info("No index attributes, use 'conf' attribute to sort TextEquiv in %s.",
|
log.info("No index attributes, use 'conf' attribute to sort TextEquiv in %s.",
|
||||||
segment_id)
|
segment_id)
|
||||||
index = np.nanargmax(confidences)
|
index = np.nanargmax(confidences)
|
||||||
else:
|
else:
|
||||||
# fallback to first entry in case of neither index or conf present
|
# fallback to first entry in case of neither index or conf present
|
||||||
LOG.warning("No index attributes, use first TextEquiv in %s.", segment_id)
|
log.warning("No index attributes, use first TextEquiv in %s.", segment_id)
|
||||||
index = 0
|
index = 0
|
||||||
return textequivs[index]
|
return textequivs[index]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue