convert text-index into text-label.
(self, text_index, text_prob=None)
| 27 | return text, label |
| 28 | |
| 29 | def decode(self, text_index, text_prob=None): |
| 30 | """convert text-index into text-label.""" |
| 31 | result_list = [] |
| 32 | batch_size = len(text_index) |
| 33 | for batch_idx in range(batch_size): |
| 34 | text = self.character[text_index[batch_idx]] |
| 35 | if text_prob is not None: |
| 36 | conf_list = text_prob[batch_idx] |
| 37 | else: |
| 38 | conf_list = 1.0 |
| 39 | result_list.append((text, conf_list)) |
| 40 | return result_list |
| 41 | |
| 42 | def add_special_char(self, dict_character): |
| 43 | return dict_character |