MCPcopy Index your code
hub / github.com/OmkarPathak/pygorithm / build_word_list

Method build_word_list

pygorithm/data_structures/trie.py:89–109  ·  view source on GitHub ↗

Recursively builds the list of words. * v: Node to check * cWord : The word built up to v

(self, v, cWord)

Source from the content-addressed store, hash-verified

87 return None
88
89 def build_word_list(self, v, cWord):
90 """
91 Recursively builds the list of words.
92 * v: Node to check
93 * cWord : The word built up to v
94 """
95 if(not v):
96 return None
97
98 wList = []
99 for i, k in v.children.items():
100 tempWord = cWord + i
101
102 if(k.word):
103 #If the iterated prefix is a word, add it to the list
104 wList.append(tempWord)
105
106 #The list of words under tWord
107 wList.extend(self.build_word_list(k, tempWord))
108
109 return wList

Callers 1

find_wordsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected