MCPcopy Create free account
hub / github.com/MiniMax-AI/VTP / get_pairs

Function get_pairs

vtp/tokenizers/text_tokenizer.py:98–107  ·  view source on GitHub ↗

Return set of symbol pairs in a word. Word is represented as tuple of symbols (symbols being variable-length strings).

(word)

Source from the content-addressed store, hash-verified

96
97
98def get_pairs(word):
99 """Return set of symbol pairs in a word.
100 Word is represented as tuple of symbols (symbols being variable-length strings).
101 """
102 pairs = set()
103 prev_char = word[0]
104 for char in word[1:]:
105 pairs.add((prev_char, char))
106 prev_char = char
107 return pairs
108
109
110def basic_clean(text):

Callers 1

bpeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected