Merge pull request #472 from toasted-nutbread/fix-pitch-accent-high-calculation
Fix high pitch calculation
This commit is contained in:
commit
a49e4ccc4e
@ -116,7 +116,11 @@ const jp = (() => {
|
|||||||
// Mora functions
|
// Mora functions
|
||||||
|
|
||||||
function isMoraPitchHigh(moraIndex, pitchAccentPosition) {
|
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) {
|
function getKanaMorae(text) {
|
||||||
|
@ -434,17 +434,17 @@ function testIsMoraPitchHigh() {
|
|||||||
[[2, 1], false],
|
[[2, 1], false],
|
||||||
[[3, 1], false],
|
[[3, 1], false],
|
||||||
|
|
||||||
[[0, 2], true],
|
[[0, 2], false],
|
||||||
[[1, 2], true],
|
[[1, 2], true],
|
||||||
[[2, 2], false],
|
[[2, 2], false],
|
||||||
[[3, 2], false],
|
[[3, 2], false],
|
||||||
|
|
||||||
[[0, 3], true],
|
[[0, 3], false],
|
||||||
[[1, 3], true],
|
[[1, 3], true],
|
||||||
[[2, 3], true],
|
[[2, 3], true],
|
||||||
[[3, 3], false],
|
[[3, 3], false],
|
||||||
|
|
||||||
[[0, 4], true],
|
[[0, 4], false],
|
||||||
[[1, 4], true],
|
[[1, 4], true],
|
||||||
[[2, 4], true],
|
[[2, 4], true],
|
||||||
[[3, 4], true]
|
[[3, 4], true]
|
||||||
|
Loading…
Reference in New Issue
Block a user