Skip to content

Instantly share code, notes, and snippets.

@wolframalpha
Last active February 22, 2019 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolframalpha/0edf2ca7929800249bec9b2cb2084271 to your computer and use it in GitHub Desktop.
Save wolframalpha/0edf2ca7929800249bec9b2cb2084271 to your computer and use it in GitHub Desktop.
import time
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
from joblib import Parallel, delayed
start_time = time.time()
texts = ['anirban das', 'chitvan gupta', 'prasad devi', 'devi prasad'] * 40
names = ['anirban das', 'devi prasad'] * 6000
def match_name(params):
text, names = params
return process.extract(text, names, limit=1)
results = Parallel(n_jobs=200, verbose=5, backend="loky")(map(delayed(match_name), map(lambda text: (text, names), texts)))
print(time.time() - start_time)
# for text in texts:
# print(text)
# print(process.extractOne(text, names))
# # break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment