-
Notifications
You must be signed in to change notification settings - Fork 3
/
example.py
32 lines (28 loc) · 863 Bytes
/
example.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
### Author: Dan6erbond ###
### Date: 08.06.2019 ###
### Version: 1.1 ###
import fuzzle
### defining a list of options with tags ###
options = [
{
"key": "GitHub",
"tags": ["Nat Friedman", "Tom Preston-Werner", "Chris Wanstrath", "Scott Chacon", "P. J. Hyett"]
},
{
"key": "Google",
"tags": ["Alphabet Inc.", "YouTube", "Sundar Pichai", "Larry Page", "Sergey Bin"]
},
{
"key": "Reddit",
"tags": ["Steve Huffman", "Alexis Ohanian", "Aaron Swartz"]
}
]
search = "GitHib" # the searched string
results = fuzzle.find(options, search)
if len(results) == 0:
print("Couldn't find any results!")
elif results[0]["match"]: # if it was a 100% identical match
print("Found {}!".format(results[0]["key"]))
else:
for result in results:
print(result["key"])