Performs invalid character removal and whitespace cleanup on text.
(self, text)
| 280 | return False |
| 281 | |
| 282 | def _clean_text(self, text): |
| 283 | """Performs invalid character removal and whitespace cleanup on text.""" |
| 284 | output = [] |
| 285 | for char in text: |
| 286 | cp = ord(char) |
| 287 | if cp == 0 or cp == 0xfffd or _is_control(char): |
| 288 | continue |
| 289 | if _is_whitespace(char): |
| 290 | output.append(" ") |
| 291 | else: |
| 292 | output.append(char) |
| 293 | return "".join(output) |
| 294 | |
| 295 | |
| 296 | class WordpieceTokenizer(object): |
no test coverage detected