matcher in lowcase
This commit is contained in:
@@ -305,6 +305,7 @@ def searchdb(sqlfile,needle):
|
|||||||
print(row[0])
|
print(row[0])
|
||||||
|
|
||||||
def matchdb(sqlfile,needle,helper):
|
def matchdb(sqlfile,needle,helper):
|
||||||
|
needle=needle.lower()
|
||||||
import difflib as dl
|
import difflib as dl
|
||||||
conn=sqlite3.connect(sqlfile)
|
conn=sqlite3.connect(sqlfile)
|
||||||
conn.text_factory=str
|
conn.text_factory=str
|
||||||
@@ -318,7 +319,7 @@ def matchdb(sqlfile,needle,helper):
|
|||||||
ratio=0
|
ratio=0
|
||||||
best_match=""
|
best_match=""
|
||||||
for row in db:
|
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()
|
s_ratio=s.ratio()
|
||||||
if ratio < s_ratio:
|
if ratio < s_ratio:
|
||||||
ratio=s_ratio
|
ratio=s_ratio
|
||||||
|
|||||||
Reference in New Issue
Block a user