GoalScope — trie (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
↵
<code>↵
class Trie:↵
"""Initialize the Trie data structure."""↵
def __init__(self):↵
self.root = {}↵
↵
"""Insert a word into the Trie."""↵
def insert(self, word: str) -> None:↵
node = self.root↵
for char in word:↵
if char not in node:↵
node[char] = {}↵
node = node[char]↵
node[\''] = True↵
↵
"""Search for a word in the Trie."""↵
def search(self, word: str) -> bool:↵
node = self.root↵
for char in word:↵
if char not in node:↵
return False↵
node = node[char]↵
return \'\' in node↵
↵
"""Check if any word in the Trie starts with the given prefix."""↵
def starts_with(self, prefix: str) -> bool:↵
node = self.root↵
for char in prefix:↵
if char not in node:↵
return False↵
node = node[char]↵
return True↵
</code>