MCPcopy Create free account
hub / github.com/modelscope/modelscope / insert

Method insert

modelscope/preprocessors/ofa/utils/text2phone.py:27–39  ·  view source on GitHub ↗

Inserts a word into the trie. :type word: str :rtype: void

(self, word)

Source from the content-addressed store, hash-verified

25 self.root = TrieNode()
26
27 def insert(self, word):
28 """
29 Inserts a word into the trie.
30 :type word: str
31 :rtype: void
32 """
33 node = self.root
34 for chars in word:
35 child = node.data.get(chars)
36 if not child:
37 node.data[chars] = TrieNode()
38 node = node.data[chars]
39 node.is_word = True
40
41 def search(self, word):
42 """

Callers 7

vae_tile_forwardMethod · 0.45
__init__Method · 0.45
create_trie_treeMethod · 0.45
split_parts_by_regexFunction · 0.45
_init_templateMethod · 0.45
_encodeMethod · 0.45
_encodeMethod · 0.45

Calls 2

TrieNodeClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected