(self, label)
| 1467 | self.english_stroke_dict[english_stroke_alphabet[index]] = index |
| 1468 | |
| 1469 | def encode(self, label): |
| 1470 | stroke_sequence = "" |
| 1471 | for character in label: |
| 1472 | if character not in self.dic: |
| 1473 | continue |
| 1474 | else: |
| 1475 | stroke_sequence += self.dic[character] |
| 1476 | stroke_sequence += "0" |
| 1477 | label = stroke_sequence |
| 1478 | |
| 1479 | length = len(label) |
| 1480 | |
| 1481 | input_tensor = np.zeros(self.max_text_len).astype("int64") |
| 1482 | for j in range(length - 1): |
| 1483 | input_tensor[j + 1] = self.english_stroke_dict[label[j]] |
| 1484 | |
| 1485 | return length, input_tensor |
| 1486 | |
| 1487 | def __call__(self, data): |
| 1488 | text = data["label"] |
no outgoing calls