matcher in lowcase

This commit is contained in:
q
2015-01-25 19:30:35 +02:00
parent c470778e79
commit 8d29bc6eda

View File

@@ -305,6 +305,7 @@ def searchdb(sqlfile,needle):
print(row[0])
def matchdb(sqlfile,needle,helper):
needle=needle.lower()
import difflib as dl
conn=sqlite3.connect(sqlfile)
conn.text_factory=str
@@ -318,7 +319,7 @@ def matchdb(sqlfile,needle,helper):
ratio=0
best_match=""
for row in db:
s=dl.SequenceMatcher(None, os.path.basename(row[0]), needle)
s=dl.SequenceMatcher(None, os.path.basename(row[0]).lower(), needle)
s_ratio=s.ratio()
if ratio < s_ratio:
ratio=s_ratio