MCPcopy
hub / github.com/kyegomez/OpenMythos / encode

Method encode

open_mythos/tokenizer.py:42–52  ·  view source on GitHub ↗

Encode input text into a list of token IDs. Args: text (str): The input text string to tokenize. Returns: list[int]: List of integer token IDs representing the input text.

(self, text: str)

Source from the content-addressed store, hash-verified

40 return self.tokenizer.vocab_size
41
42 def encode(self, text: str) -> list[int]:
43 """
44 Encode input text into a list of token IDs.
45
46 Args:
47 text (str): The input text string to tokenize.
48
49 Returns:
50 list[int]: List of integer token IDs representing the input text.
51 """
52 return self.tokenizer.encode(text, add_special_tokens=False)
53
54 def decode(self, token_ids: list[int]) -> str:
55 """

Callers 7

__iter__Method · 0.80
__init__Method · 0.80
test_encode_empty_stringFunction · 0.80
test_roundtripFunction · 0.80
test_encode_long_textFunction · 0.80

Calls

no outgoing calls

Tested by 5

test_encode_empty_stringFunction · 0.64
test_roundtripFunction · 0.64
test_encode_long_textFunction · 0.64