From ce000695c484849c74d5349a7ba60594b6971f6e Mon Sep 17 00:00:00 2001 From: Charles Loder Date: Tue, 31 Oct 2023 20:00:02 -0400 Subject: [PATCH 1/3] Update test inputs for niqqud --- test/syllable.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/syllable.test.ts b/test/syllable.test.ts index c3c07b8..00ee689 100644 --- a/test/syllable.test.ts +++ b/test/syllable.test.ts @@ -130,9 +130,9 @@ describe.each` ${"syllable with silent sheva"} | ${"הַֽ֭יְחָבְרְךָ"} | ${2} | ${"\u{05B8}"} | ${false} ${"syllable with none"} | ${"test"} | ${0} | ${null} | ${true} ${"syllable with shureq"} | ${"תִגְּע֖וּ"} | ${2} | ${"\u{05D5}\u{05BC}"} | ${false} - ${"syllable with tsere-yod"} | ${"קָדְשֵׁ֧י"} | ${1} | ${"\u{05B5}"} | ${true} - ${"syllable with holam-vav"} | ${"בַּיּ֣וֹם"} | ${1} | ${"\u{05B9}"} | ${true} - ${"syllable with hiriq-yod"} | ${"אָנֹֽכִי"} | ${2} | ${"\u{05B4}"} | ${true} + ${"syllable with tsere-yod"} | ${"קָדְשֵׁ֧י"} | ${1} | ${"\u{05B5}"} | ${false} + ${"syllable with holam-vav"} | ${"בַּיּ֣וֹם"} | ${1} | ${"\u{05B9}"} | ${false} + ${"syllable with hiriq-yod"} | ${"אָנֹֽכִי"} | ${2} | ${"\u{05B4}"} | ${false} `("vowel:", ({ description, hebrew, syllableNum, vowel, allowNoNiqqud }) => { // normally don't use `allowNoNiqqud` in testing, but needed to get `null` const heb = new Text(hebrew, { allowNoNiqqud }); @@ -153,8 +153,8 @@ describe.each` ${"syllable with none"} | ${"test"} | ${0} | ${null} | ${true} ${"syllable with shureq"} | ${"תִגְּע֖וּ"} | ${2} | ${"SHUREQ"} | ${false} ${"syllable with tsere-yod"} | ${"קָדְשֵׁ֧י"} | ${1} | ${"TSERE"} | ${false} - ${"syllable with holam-vav"} | ${"בַּיּ֣וֹם"} | ${1} | ${"HOLAM"} | ${true} - ${"syllable with hiriq-yod"} | ${"אָנֹֽכִי"} | ${2} | ${"HIRIQ"} | ${true} + ${"syllable with holam-vav"} | ${"בַּיּ֣וֹם"} | ${1} | ${"HOLAM"} | ${false} + ${"syllable with hiriq-yod"} | ${"אָנֹֽכִי"} | ${2} | ${"HIRIQ"} | ${false} `("vowelName:", ({ description, hebrew, syllableNum, vowelName, allowNoNiqqud }) => { // normally don't use `allowNoNiqqud` in testing, but needed to get `null` const heb = new Text(hebrew, { allowNoNiqqud }); From bbee094b2291ccb0876e181b4322c927382cc366 Mon Sep 17 00:00:00 2001 From: Charles Loder Date: Tue, 31 Oct 2023 20:00:15 -0400 Subject: [PATCH 2/3] Add mixed char tests --- test/syllable.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/syllable.test.ts b/test/syllable.test.ts index 00ee689..0439113 100644 --- a/test/syllable.test.ts +++ b/test/syllable.test.ts @@ -30,6 +30,7 @@ describe.each` ${"syllable with tsere-yod"} | ${"קָדְשֵׁ֧י"} | ${1} | ${"TSERE"} | ${true} ${"syllable with holam-vav"} | ${"בַּיּ֣וֹם"} | ${1} | ${"HOLAM"} | ${true} ${"syllable with hiriq-yod"} | ${"אָנֹֽכִי"} | ${2} | ${"HIRIQ"} | ${true} + ${"syllable with mixed chars"} | ${"rˁִː֣"} | ${0} | ${"HIRIQ"} | ${true} `("hasVowelName:", ({ description, hebrew, syllableNum, vowelName, result }) => { const heb = new Text(hebrew); const syllable = heb.syllables[syllableNum]; @@ -133,6 +134,7 @@ describe.each` ${"syllable with tsere-yod"} | ${"קָדְשֵׁ֧י"} | ${1} | ${"\u{05B5}"} | ${false} ${"syllable with holam-vav"} | ${"בַּיּ֣וֹם"} | ${1} | ${"\u{05B9}"} | ${false} ${"syllable with hiriq-yod"} | ${"אָנֹֽכִי"} | ${2} | ${"\u{05B4}"} | ${false} + ${"syllable with mixed chars"} | ${"rˁִː֣"} | ${0} | ${"\u{05B4}"} | ${false} `("vowel:", ({ description, hebrew, syllableNum, vowel, allowNoNiqqud }) => { // normally don't use `allowNoNiqqud` in testing, but needed to get `null` const heb = new Text(hebrew, { allowNoNiqqud }); @@ -155,6 +157,7 @@ describe.each` ${"syllable with tsere-yod"} | ${"קָדְשֵׁ֧י"} | ${1} | ${"TSERE"} | ${false} ${"syllable with holam-vav"} | ${"בַּיּ֣וֹם"} | ${1} | ${"HOLAM"} | ${false} ${"syllable with hiriq-yod"} | ${"אָנֹֽכִי"} | ${2} | ${"HIRIQ"} | ${false} + ${"syllable with mixed chars"} | ${"rˁִː֣"} | ${0} | ${"HIRIQ"} | ${true} `("vowelName:", ({ description, hebrew, syllableNum, vowelName, allowNoNiqqud }) => { // normally don't use `allowNoNiqqud` in testing, but needed to get `null` const heb = new Text(hebrew, { allowNoNiqqud }); From 0428d05fb3600988966a1e05518a550e439d2c9f Mon Sep 17 00:00:00 2001 From: Charles Loder Date: Tue, 31 Oct 2023 20:00:30 -0400 Subject: [PATCH 3/3] Update syllable vowel prop for mixed chars --- src/syllable.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/syllable.ts b/src/syllable.ts index 4e43646..ad8fb4e 100644 --- a/src/syllable.ts +++ b/src/syllable.ts @@ -145,8 +145,8 @@ export class Syllable extends Node { return noTaamim; } - // for maters, we have to match the vowel character - const match = noTaamim.match(vowelsCaptureGroupWithSheva); + // for maters or text with mixed scripts (e.g. Hebrew and Latin), we have to extract the vowel character + const match = this.text.match(vowelsCaptureGroupWithSheva); if (match && this.isVowelKeyOfSyllableCharToNameMap(match[0])) { return match[0]; }