From 2f931e55854daf552f1080ba41b81782000b5e0e Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 22 Apr 2020 21:04:18 -0400 Subject: Fix high pitch calculation --- ext/mixed/js/japanese.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/mixed/js/japanese.js b/ext/mixed/js/japanese.js index 79d69946..ced486dd 100644 --- a/ext/mixed/js/japanese.js +++ b/ext/mixed/js/japanese.js @@ -116,7 +116,11 @@ const jp = (() => { // Mora functions function isMoraPitchHigh(moraIndex, pitchAccentPosition) { - return pitchAccentPosition === 0 ? (moraIndex > 0) : (moraIndex < pitchAccentPosition); + switch (pitchAccentPosition) { + case 0: return (moraIndex > 0); + case 1: return (moraIndex < 1); + default: return (moraIndex > 0 && moraIndex < pitchAccentPosition); + } } function getKanaMorae(text) { -- cgit v1.2.3