MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / tokenize

Method tokenize

NLP/UNIMO/src/model/tokenization.py:314–321  ·  view source on GitHub ↗

tokenize the text

(self, text)

Source from the content-addressed store, hash-verified

312 self.wordpiece_tokenizer = WordpieceTokenizer(vocab=self.vocab)
313
314 def tokenize(self, text):
315 """tokenize the text"""
316 split_tokens = []
317 for token in self.basic_tokenizer.tokenize(text):
318 for sub_token in self.wordpiece_tokenizer.tokenize(token):
319 split_tokens.append(sub_token)
320
321 return split_tokens
322
323 def convert_tokens_to_ids(self, tokens):
324 """convert tokens to vocab ids"""

Callers 5

tokenizeMethod · 0.45
_text_to_idsMethod · 0.45
evalMethod · 0.45

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected