-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
41 lines (29 loc) · 684 Bytes
/
Copy pathtest.py
File metadata and controls
41 lines (29 loc) · 684 Bytes
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
39
40
41
from suffixTree.suffixTree import SuffixTree
from suffixTree.helpers.searchPattern import SearchPattern
from suffixTree.helpers.lrs import LRS
from suffixTree.helpers.lcs import LCS
from suffixTree.helpers.lps import LPS
tree = SuffixTree(["Geeksatb", "batl"], True)
search = SearchPattern(tree, "at")
print(search.search())
""" Output
{'1': [1], '0': [5]}
"""
tree = SuffixTree(["abcpqrabcpqpq"], True)
lrs = LRS(tree, 2)
print(lrs.find())
""" Output
abcpq
"""
tree = SuffixTree(["xabxac", "abcabxabcd"], True)
lcs = LCS(tree, 2)
print(lcs.find())
""" Output
abxa
"""
tree = SuffixTree(["xababayz"], True, True)
lps = LPS(tree)
print(lps.find())
""" Output
ababa
"""