Skip to content Skip to sidebar Skip to footer

Using Process.extract In Fuzzywuzzy And The All Max Similar Choices

I have the following input- query = 'Total replenishment lead time (in workdays)' choices = ['PLANNING_TIME_FENCE_CODE', 'BUILD_IN_WIP_FLAG','Lead_time_planning', 'Total replenishm

Solution 1:

If I understand your question correct you would like to receive the following output:

[('Total replenishment lead time 1', 92), ('Total replenishment lead time  2', 92)]

You can achieve this by filtering the results of process.extract

matches = process.extract(query, choices, limit=None)
max_ratio = matches[0][1]
best_matches = []
for match in matches:
  if match[1] != max_ratio:
    break
  best_matches.append(match)

Post a Comment for "Using Process.extract In Fuzzywuzzy And The All Max Similar Choices"