Summary
dedupe() calls extractBests(..., score_cutoff=threshold) per item and then max(matches, ...). When an item is reduced to the empty string by the default processor (utils.full_process), every comparison scores 0, so extractBests returns [] (default threshold 70) and max([]) raises ValueError: max() arg is an empty sequence. The code even warns that a processor-emptied query makes all comparisons score 0, then calls max() unconditionally.
Reproduction
from thefuzz.process import dedupe
dedupe(['###', 'apple', 'apple pie'])
# ValueError: max() iterable argument is empty
(utils.full_process('###') yields ''.)
Expected
dedupe() handles an empty-processed item gracefully (e.g. keeps it as its own cluster), rather than crashing.
Actual
Uncaught ValueError from max([]).
Environment
thefuzz 0.22.1 (master @ 1ba86f3), Python 3.12.
Summary
dedupe()callsextractBests(..., score_cutoff=threshold)per item and thenmax(matches, ...). When an item is reduced to the empty string by the default processor (utils.full_process), every comparison scores 0, soextractBestsreturns[](default threshold 70) andmax([])raisesValueError: max() arg is an empty sequence. The code even warns that a processor-emptied query makes all comparisons score 0, then callsmax()unconditionally.Reproduction
(
utils.full_process('###')yields''.)Expected
dedupe()handles an empty-processed item gracefully (e.g. keeps it as its own cluster), rather than crashing.Actual
Uncaught
ValueErrorfrommax([]).Environment
thefuzz 0.22.1 (master @ 1ba86f3), Python 3.12.