Here is the example where I was stuck. The python implemention gets 22, and the java implementation gets 23:
fuzz.token_set_ratio(
"Vêndo ou troco por outro carro pode ser atrasado negócio volta ",
"Titan 150 ano 2005 ",
False
)
FuzzySearch.tokenSetRatio(
"Vêndo ou troco por outro carro pode ser atrasado negócio volta",
"Titan 150 ano 2005"
);
Debugging both code I could find that the problem is when rounding the value: 22.5
Python code, located in utils.py:
Java code, located in SimpleRatio class is:
(int) Math.round(100 * DiffUtils.getRatio(s1, s2));
TLDR:
Java: Math.round(22.5) => 23
Python: round(22.5) => 22
Don't know which one is correct for this algorithm...
Here is the example where I was stuck. The python implemention gets 22, and the java implementation gets 23:
Debugging both code I could find that the problem is when rounding the value: 22.5
Python code, located in
utils.py:Java code, located in
SimpleRatioclass is:TLDR:
Java:
Math.round(22.5)=> 23Python:
round(22.5)=> 22Don't know which one is correct for this algorithm...