Skip to content

Commit

Permalink
make sure strings are suitable length before checking for plurals (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
bovard authored Jun 18, 2024
1 parent c6ccfb8 commit ecdf7a3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kaggle_environments/envs/llm_20_questions/llm_20_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ def compare_words(a, b) -> bool:
b = normalize(b)
if a == b:
return True
# don't check for plurals if string is too short
if len(a) < 3 or len(b) < 3:
return False
# accept common plurals
if a[-1] == "s" and a[:-1] == b:
return True
Expand Down

0 comments on commit ecdf7a3

Please sign in to comment.