Add word-overlap gate to _fuzzy_keyword_match to avoid unnecessary LLM calls
LLM plural check was firing for every non-exact keyword pair (e.g. "insert molding" vs "cement plant lubrication"), causing timeouts and wasted API calls. Now requires keywords to share all but one word before escalating to the LLM. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>clickup-runner
parent
bba634a63e
commit
99b000f25a
|
|
@ -285,6 +285,15 @@ def _fuzzy_keyword_match(a: str, b: str, llm_check: Callable[[str, str], bool] |
|
|||
return True
|
||||
if llm_check is None:
|
||||
return False
|
||||
|
||||
# Only call LLM when keywords share most words (possible plural difference).
|
||||
words_a = set(a.split())
|
||||
words_b = set(b.split())
|
||||
shared = words_a & words_b
|
||||
total = max(len(words_a), len(words_b))
|
||||
if total > 1 and len(shared) < total - 1:
|
||||
return False
|
||||
|
||||
return llm_check(a, b)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue