Last active
February 22, 2019 11:17
-
-
Save wolframalpha/0edf2ca7929800249bec9b2cb2084271 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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