-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathui.py
38 lines (28 loc) · 763 Bytes
/
ui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import cmd
from fuzz_complete import *
addresses = [
]
data = open("./data/google-10000-english.txt", "r")
for line in data.readlines()[:1000]:
word = line.strip()
trie.insert(word)
class MyCmd(cmd.Cmd):
def do_start(self, line):
pass
def complete_start(self, text, line, start_index, end_index):
if text:
results = search(text, 2, True)
return [
result[0][:] for result in results
]
# text = text.replace(" ", "")
# return text
else:
return "type something"
if __name__ == '__main__':
my_cmd = MyCmd()
my_cmd.cmdloop()