mlx.data.core.CharTrie.search#
- CharTrie.search(self: mlx.data._c.core.CharTrie, token: Union[str, List[str]]) mlx.data._c.core.CharTrieNode #
Search a the passed string or list of characters in the trie and return the node or None if not found.
To get the id of a token it suffices to do:
print(trie.search("hello").id)
However, if ‘hello’ is not in the vocabulary then
CharTrie.search()
will return None.