MCPcopy Index your code
hub / github.com/THUDM/GLM / EncodeAsTokens

Method EncodeAsTokens

data_utils/tokenization.py:1214–1222  ·  view source on GitHub ↗
(self, text, process_fn=None)

Source from the content-addressed store, hash-verified

1212 return ids
1213
1214 def EncodeAsTokens(self, text, process_fn=None):
1215 processed_text = text
1216 if process_fn is not None:
1217 processed_text = process_fn(processed_text)
1218 tokens = self.text_tokenizer.tokenize(processed_text)
1219 tokenization = Tokenization(tokens, processed_text, text, asIds=False)
1220 tokenization.set_command_tokens(self._command_tokens)
1221 return tokenization
1222 # return Tokenization(tokens, processed_text, text, asIds=False)
1223
1224 def IdToToken(self, Id, type_token=False):
1225 if isinstance(Id, (TypeToken, CommandToken)):

Callers

nothing calls this directly

Calls 3

set_command_tokensMethod · 0.95
TokenizationClass · 0.85
tokenizeMethod · 0.45

Tested by

no test coverage detected