(self, text_seq)
| 1633 | ) |
| 1634 | |
| 1635 | def encode(self, text_seq): |
| 1636 | text_seq_encoded = [] |
| 1637 | for text in text_seq: |
| 1638 | if text not in self.character: |
| 1639 | continue |
| 1640 | text_seq_encoded.append(self.dict.get(text)) |
| 1641 | if len(text_seq_encoded) == 0: |
| 1642 | return None |
| 1643 | return text_seq_encoded |
| 1644 | |
| 1645 | def __call__(self, data): |
| 1646 | label = data["label"] |