def _tokenize_wordpiece(self, text):
output_tokens = []<EOL>for token in self.basic_tokenizer._whitespace_tokenize(text):<EOL><INDENT>chars = list(token)<EOL>if len(chars) > self.max_input_chars_per_word:<EOL><INDENT>output_tokens.append(self.vocab.unknown_token)<EOL>continue<EOL><DEDENT>is_bad = False<EOL>start = <NUM_LIT:0><EOL>sub_tokens = []<EOL>while start < len(chars):<EOL><INDENT>end = len(chars)<EOL>cur_substr = None<EOL>while start < end:<EOL><INDENT>substr = '<STR_LIT>'.join(chars[start:end])<EOL>if start > <NUM_LIT:0>:<EOL><INDENT>substr = '<STR_LIT>' + substr<EOL><DEDENT>if substr in self.vocab:<EOL><INDENT>cur_substr = substr<EOL>break<EOL><DEDENT>end -= <NUM_LIT:1><EOL><DEDENT>if cur_substr is None:<EOL><INDENT>is_bad = True<EOL>break<EOL><DEDENT>sub_tokens.append(cur_substr)<EOL>start = end<EOL><DEDENT>if is_bad:<EOL><INDENT>output_tokens.append(self.vocab.unknown_token)<EOL><DEDENT>else:<EOL><INDENT>output_tokens.extend(sub_tokens)<EOL><DEDENT><DEDENT>return output_tokens<EOL>
Tokenizes a piece of text into its word pieces.

        This uses a greedy longest-match-first algorithm to perform tokenization
        using the given vocabulary.

        For example:
          input = "unaffable"
          output = ["un", "##aff", "##able"]

        Args:
          text: A single token or whitespace separated tokens. This should have
            already been passed through `BERTBasicTokenizer.

        Returns:
          A list of wordpiece tokens.