Skip to content

Instantly share code, notes, and snippets.

@ecarreras
Last active December 20, 2015 16:39
Show Gist options
  • Save ecarreras/6163087 to your computer and use it in GitHub Desktop.
Save ecarreras/6163087 to your computer and use it in GitHub Desktop.
Exemple d'utilització de la llibreria fuzzywuzzy https://github.com/gisce/fuzzywuzzy
from fuzzywuzzy import process
from fuzzywuzzy.utils import full_process
def processor(choice):
return full_process(choice[1])
res = process.extractOne(poblacio, poblacions_list, processor)
if not res:
print "Població no trobada: %s" % poblacio
continue
if res[1] >= 95:
msg = "%s => %s (%s)" % (poblacio, res[0], res[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment