MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / final_decode

Method final_decode

openrec/postprocess/mgp_postprocess.py:63–78  ·  view source on GitHub ↗
(self, char_text, bpe_text, wp_text)

Source from the content-addressed store, hash-verified

61 return dict_character
62
63 def final_decode(self, char_text, bpe_text, wp_text):
64 result_list = []
65 for (char_pred,
66 char_pred_conf), (bpe_pred,
67 bpe_pred_conf), (wp_pred, wp_pred_conf) in zip(
68 char_text, bpe_text, wp_text):
69 final_text = char_pred
70 final_prob = char_pred_conf
71 if bpe_pred_conf > final_prob:
72 final_text = bpe_pred
73 final_prob = bpe_pred_conf
74 if wp_pred_conf > final_prob:
75 final_text = wp_pred
76 final_prob = wp_pred_conf
77 result_list.append((final_text, final_prob))
78 return result_list
79
80 def char_decode(self, text_index, text_prob=None):
81 """ convert text-index into text-label. """

Callers 1

__call__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected