Feature: 40 bilingual questions, random 10 game run, difficulty levels, and full i18n support
This commit is contained in:
+5
-1
@@ -33,12 +33,16 @@ def levenshtein_distance(s1: str, s2: str) -> int:
|
||||
previous_row = current_row
|
||||
return previous_row[-1]
|
||||
|
||||
def is_answer_correct(user_input: str, canonical: str, accepted_raw: str | None = None) -> bool:
|
||||
def is_answer_correct(user_input: str, canonical: str, accepted_raw: str | None = None, canonical_en: str | None = None) -> bool:
|
||||
clean_user = normalize_text(user_input)
|
||||
if not clean_user:
|
||||
return False
|
||||
|
||||
targets = [normalize_text(canonical)]
|
||||
if canonical_en:
|
||||
clean_en = normalize_text(canonical_en)
|
||||
if clean_en and clean_en not in targets:
|
||||
targets.append(clean_en)
|
||||
|
||||
if accepted_raw:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user