-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.py
36 lines (28 loc) · 830 Bytes
/
test.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
from trie_oop import *
trie = Trie()
file_in = 'dict.txt'
f = open(file_in)
for line in f:
trie.addWord(line.strip())
f.close()
trie.addWord('doughnut')
trie.addWord('donut')
trie.addWord('donald')
trie.addWord('domino')
trie.addWord('dominion')
searched_word = 'second'
print('foud "', searched_word, '":', trie.hasWord(searched_word))
searched_word = 'time'
print('foud "', searched_word, '":', trie.hasWord(searched_word))
searched_word = 'domino'
print('foud "', searched_word, '":', trie.hasWord(searched_word))
searched_word = 'dominique'
print('foud "', searched_word, '":', trie.hasWord(searched_word))
print()
print('#words:', trie.countWords())
print('size:', trie.getSize())
print('#letters:', trie.countLetters())
print('compression:', trie.compression())
print()
trie.display()
trie.diagram('test', True)