Heng2004 commited on
Commit
1406a1d
·
verified ·
1 Parent(s): ad8bcc2

Update model_utils.py

Browse files
Files changed (1) hide show
  1. model_utils.py +4 -1
model_utils.py CHANGED
@@ -148,7 +148,10 @@ def answer_from_qa(question: str) -> Optional[str]:
148
  best_score = overlap
149
  best_answer = item["a"]
150
 
151
- if best_score >= 1:
 
 
 
152
  return best_answer
153
 
154
  return None
 
148
  best_score = overlap
149
  best_answer = item["a"]
150
 
151
+ # require at least 2 overlapping words to accept fuzzy match
152
+ if best_score >= 2:
153
+ # optional: log when fuzzy match is used
154
+ print(f"[FUZZY MATCH] score={best_score} -> {best_answer[:50]!r}")
155
  return best_answer
156
 
157
  return None