How to install python-Levenshtein on Windows? Getting an error when using fuzzywuzzy?

Viewed 627

I'm writing a program that returns a list of tuples, each tuple consisting of closely matching strings present in two lists A and B using the python module fuzzywuzzy. However, on running this code, I'm getting this error:

UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove these warning warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')

I can't seem to find a way to install python-Levenshtein on Windows (tried pip install python-Levenshtein but that errored with exit status 1). Is there some way I could install it and get this running? Or is there something else I'm missing?

import mysql.connector
# importing python library that has a method process which computes degree of match between two strings
from fuzzywuzzy import process
# importing dictionary of professors that I stored in another Py file
from dictionary import dictOfInstructors

conn = mysql.connector.connect(
    #connected database here
)
cur = conn.cursor()


def matchedInstructors(A, B):
    listOfMatchedInstructors = []
    for record in A:
        nameFromDatabase = record[2] + " " + record[1]
        matchedResults = process.extract(nameFromDatabase, B, limit=3)
        resultList = [result[0] for result in matchedResults]
        listOfMatchedInstructors.append(tuple(resultList))

    print(listOfMatchedInstructors)


query = 'select * from instructors;'

cur.execute(query)

matchedInstructors(cur.fetchall(), dictOfInstructors["names"])


cur.close()
conn.close()
0 Answers
Related