Penut commited on
Commit
47e16f4
1 Parent(s): 2a30efc

relax the criteria

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -12,6 +12,7 @@ b_base = ["a", "i", "u", "e", "o"]
12
  b_ext = ["ya", "yo", "yu"]
13
 
14
  invalid = ["yi", "ye", "wi", "wu", "we"]
 
15
 
16
 
17
  def next_question(hira, kata, c, quiz_list):
@@ -73,8 +74,22 @@ def combine(a, b):
73
 
74
 
75
  def check(kana: str, roma: str, correct, total):
 
 
76
  kana_roma = to_roma(kana)
77
- ans_correct = kana_roma == roma.lower()
 
 
 
 
 
 
 
 
 
 
 
 
78
  correct += ans_correct
79
  total += 1
80
 
 
12
  b_ext = ["ya", "yo", "yu"]
13
 
14
  invalid = ["yi", "ye", "wi", "wu", "we"]
15
+ spec_map = {"cya": "cha", "cyu": "chu", "cyo": "cho"}
16
 
17
 
18
  def next_question(hira, kata, c, quiz_list):
 
74
 
75
 
76
  def check(kana: str, roma: str, correct, total):
77
+ roma = roma.lower()
78
+
79
  kana_roma = to_roma(kana)
80
+ roma_hira = to_hiragana(roma)
81
+ roma_kata = to_katakana(roma)
82
+ spec_roma = spec_map.get(roma, roma)
83
+ spec_hira = to_hiragana(spec_roma)
84
+ spec_kata = to_katakana(spec_roma)
85
+
86
+ c0 = kana_roma == roma
87
+ c1 = roma_hira == kana
88
+ c2 = roma_kata == kana
89
+ c3 = spec_hira == kana
90
+ c4 = spec_kata == kana
91
+
92
+ ans_correct = any((c0, c1, c2, c3, c4))
93
  correct += ans_correct
94
  total += 1
95