diff --git a/templates/Japanese sentences/Recognition/front.html b/templates/Japanese sentences/Recognition/front.html index 385e1f3..5823760 100644 --- a/templates/Japanese sentences/Recognition/front.html +++ b/templates/Japanese sentences/Recognition/front.html @@ -31,6 +31,7 @@ Fri Jul 7 06:33:50 PM UTC 2023
@@ -85,8 +86,21 @@ Fri Jul 7 06:33:50 PM UTC 2023 if (vocab_kana === null) { return false; } - // small っ is one mora; ゃゅょ are parts of single mora - const n_moras = vocab_kana.innerHTML.replace(/[ャュョゃゅょ]/g, "").length; + let moras = vocab_kana.innerHTML + .replace(/[((<].*[>))]/, "") // remove (お), (する), <する>, <な>, etc + .replace(/[ャュョゃゅょ]/g, "") // small っ is one mora; ゃゅょ are parts of single mora + .trim(); + + let n_moras; + // first determine if な is part of pronunciation or な-adjective (e.g. 女) + const vocab_kanji = document.getElementById("vocab_kanji").innerHTML.trim(); + if (/な$/.test(vocab_kanji)) { + // な-adjectives don't change pitch + n_moras = moras.replace(/な$/, "").length; + } else { + n_moras = moras.length; + } + if (n_moras == pitch_num) { return true; } else {