AnsweredAssumed Answered

Field calculator Python function using Fuzzy string

Question asked by ahmednasserhassan on Mar 23, 2017
Latest reply on Mar 25, 2017 by ahmednasserhassan

I want to -simply- compare the values from three columns using Fuzzywuzzy python library and return the percentage value.

 

I want to do something like this, but of course, this function is not working!

How I can make this one work.

 

from fuzzywuzzy import fuzz
from fuzzywuzzy import process
def function(query,v1,v2,v3)
choices = [v1,v2,v3 ]
result= process.extractOne(query, choices)
return result

 

I can make Fuzzy work for comparing only two columns like this.

 

Pre-logic script code:
from fuzzywuzzy import fuzz
from fuzzywuzzy import process

 

--------------------------------------------

fuzz.ratio(!column1!, !column2!)

this link can give you an idea about  Fuzzy string: Fuzzy String Matching in Python – Marco Bonzanini 

 

I will really appreciate your help.

 

Thanks,

Outcomes