-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhybridJaccardTestOld.py
executable file
·34 lines (29 loc) · 1.25 KB
/
hybridJaccardTestOld.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
import re
import sys
import hybridJaccard as hj
def main():
colors = []
sm = hj.HybridJaccard(ref_path='eye_reference.txt', config_path='eye_config.txt')
with open("oldTestInput.txt") as input:
for line in input:
line = line.strip()
#line = line.lower()
args = re.search('([0-9]+) <(.*)> (.*)', line)
#print(args.group(3))
match = sm.findBestMatchStringCached(args.group(3))
if match is None:
match = "NONE"
#match = sm.findBestMatch(line)
print(line+" => "+match)
# test for non-default reference sets
print "hair-reference:"
h = hj.HybridJaccard(ref_path='hair_reference.txt', config_path='hair_config.txt')
print "long blond hair => " + h.findBestMatchString(u'long blond hair')
print "platinum hair => " + h.findBestMatchString(u'platinum hair')
print "eye-reference:"
e = hj.HybridJaccard(ref_path='eye_reference.txt', config_path='eye_config.txt')
print "beautiful blue eyes => " + e.findBestMatchString(u'beautiful blue eyes')
print "eyes of green => " + e.findBestMatchString(u'eyes of green')
# call main() if this is run as standalone
if __name__ == "__main__":
sys.exit(main())