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

Method label_reverse

openrec/preprocess/ctc_label_encode.py:49–63  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

47 self.character = dict_character
48
49 def label_reverse(self, text):
50 text_re = []
51 c_current = ''
52 for c in text:
53 if not bool(re.search('[a-zA-Z0-9 :*./%+١٢٣٤٥٦٧٨٩٠-]', c)):
54 if c_current != '':
55 text_re.append(c_current)
56 text_re.append(c)
57 c_current = ''
58 else:
59 c_current += c
60 if c_current != '':
61 text_re.append(c_current)
62
63 return ''.join(text_re[::-1])
64
65 def add_special_char(self, dict_character):
66 return dict_character

Callers 1

__call__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected