MCPcopy
hub / github.com/huggingface/transformers / test_trie_split

Method test_trie_split

tests/utils/test_tokenization_utils.py:229–235  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

227 self.assertEqual(trie.data, {"H": {"e": {"l": {"l": {"o": {"": 1, " ": {"友": {"達": {"": 1}}}}}}}}})
228
229 def test_trie_split(self):
230 trie = Trie()
231 self.assertEqual(trie.split("[CLS] This is a extra_id_100"), ["[CLS] This is a extra_id_100"])
232 trie.add("[CLS]")
233 trie.add("extra_id_1")
234 trie.add("extra_id_100")
235 self.assertEqual(trie.split("[CLS] This is a extra_id_100"), ["[CLS]", " This is a ", "extra_id_100"])
236
237 def test_trie_single(self):
238 trie = Trie()

Callers

nothing calls this directly

Calls 3

splitMethod · 0.95
addMethod · 0.95
TrieClass · 0.90

Tested by

no test coverage detected