Penut commited on
Commit
1dbaa4c
1 Parent(s): 8cef97c

to lowercase

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -69,13 +69,13 @@ def combine(a, b):
69
  return f"{a}{b}"
70
 
71
 
72
- def check(question, answer, correct, total):
73
- groundtruth = to_roma(question)
74
- ans_correct = groundtruth == answer
75
  correct += ans_correct
76
  total += 1
77
 
78
- info = "正確" if ans_correct else f"錯誤 - {question} ({groundtruth})"
79
  msg = f"{correct}/{total} - " + info
80
 
81
  return correct, total, msg, ""
 
69
  return f"{a}{b}"
70
 
71
 
72
+ def check(kana: str, roma: str, correct, total):
73
+ kana_roma = to_roma(kana)
74
+ ans_correct = kana_roma == roma.lower()
75
  correct += ans_correct
76
  total += 1
77
 
78
+ info = "正確" if ans_correct else f"錯誤 - {kana} ({kana_roma})"
79
  msg = f"{correct}/{total} - " + info
80
 
81
  return correct, total, msg, ""