Performs invalid character removal and whitespace cleanup on text.
(self, text)
| 471 | return False |
| 472 | |
| 473 | def _clean_text(self, text): |
| 474 | """Performs invalid character removal and whitespace cleanup on text.""" |
| 475 | output = [] |
| 476 | for char in text: |
| 477 | cp = ord(char) |
| 478 | if cp == 0 or cp == 0xFFFD or _is_control(char): |
| 479 | continue |
| 480 | if _is_whitespace(char): |
| 481 | output.append(" ") |
| 482 | else: |
| 483 | output.append(char) |
| 484 | return "".join(output) |
| 485 | |
| 486 | |
| 487 | class WordpieceTokenizer(object): |
nothing calls this directly
no test coverage detected