MCPcopy
hub / github.com/FlagAI-Open/FlagAI / add

Method add

flagai/data/tokenizer/uni_tokenizer/tokenization_utils.py:14–22  ·  view source on GitHub ↗
(self, word: str)

Source from the content-addressed store, hash-verified

12 self.data = {}
13
14 def add(self, word: str):
15 if not word:
16 # Prevent empty string
17 return
18 ref = self.data
19 for char in word:
20 ref[char] = char in ref and ref[char] or {}
21 ref = ref[char]
22 ref[""] = 1
23
24 def split(self, text: str) -> List[str]:
25 states = OrderedDict()

Callers 9

_create_trieMethod · 0.95
read_set_from_fileFunction · 0.45
mainFunction · 0.45
_create_examplesMethod · 0.45
get_pairsFunction · 0.45
get_pairsFunction · 0.45
get_pairsFunction · 0.45
splitMethod · 0.45
get_pairsFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected