MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / tokenize

Method tokenize

demo/BERT/helpers/tokenization.py:211–216  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

209 self.wordpiece_tokenizer = WordpieceTokenizer(vocab=self.vocab)
210
211 def tokenize(self, text):
212 split_tokens = []
213 for token in self.basic_tokenizer.tokenize(text):
214 for sub_token in self.wordpiece_tokenizer.tokenize(token):
215 split_tokens.append(sub_token)
216 return split_tokens
217
218 def convert_tokens_to_ids(self, tokens):
219 """Converts a sequence of tokens into ids using the vocab."""

Callers

nothing calls this directly

Calls 2

tokenizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected