Skip to content

Commit 13daa11

Browse files
author
stephanie gross
committed
WIP
1 parent 4864f78 commit 13daa11

File tree

4 files changed

+3
-718
lines changed

4 files changed

+3
-718
lines changed

ragability/checks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def affirmative(answer):
7979
:param answer: the answer text
8080
:return: 1 if the answer is affirmative, 0 otherwise
8181
"""
82-
return "1" if answer.lower() in ["yes", "true", "positive"] else "0"
82+
return "1" if answer.strip().lower() in ["yes", "true", "positive"] else "0"
8383

8484

8585
@register_check("negative", "binary", 0,
@@ -91,7 +91,7 @@ def negative(answer):
9191
:param answer: the answer text
9292
:return: 1 if the answer is negative, 0 otherwise
9393
"""
94-
return "1" if answer.lower() in ["no", "false", "negative"] else "0"
94+
return "1" if answer.strip().lower() in ["no", "false", "negative"] else "0"
9595

9696

9797
@register_check("unknown", "binary", 0,
@@ -164,4 +164,4 @@ def extract_score(answer):
164164
numbers = [float(s) for s in re.findall(r'-?\d+\.?\d*', answer)]
165165
if len(numbers) != 1:
166166
raise Exception(f"Error: Expected exactly one number in the answer, got {len(numbers)}")
167-
return numbers[0]
167+
return numbers[0]

ragability/checks2.py

Lines changed: 0 additions & 173 deletions
This file was deleted.

0 commit comments

Comments
 (0)