From a665b084ca329e4526a343e67712490baea5fd4a Mon Sep 17 00:00:00 2001 From: charlesLoder Date: Sat, 9 Mar 2024 13:10:43 -0500 Subject: [PATCH 1/2] Add test for single ole --- test/syllable.isAccented.test.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/syllable.isAccented.test.ts b/test/syllable.isAccented.test.ts index 3c2c483..f9272da 100644 --- a/test/syllable.isAccented.test.ts +++ b/test/syllable.isAccented.test.ts @@ -195,9 +195,15 @@ describe("Test if a syllable is accented", () => { }); }); - test("ole-weyored", () => { - // only the ole is prepositive - testIsAccented("רְשָׁ֫עִ֥ים", [false, false, true]); + describe("ole-weyored", () => { + test("ole-weyored", () => { + // only the ole is prepositive + testIsAccented("רְשָׁ֫עִ֥ים", [false, false, true]); + }); + + test("ole alone", () => { + testIsAccented("טַ֫עַם", [true, false]); + }); }); describe("dechi", () => { From 6ed5cb6eb3742a8f3b4740db8fe5f4dc926c90e8 Mon Sep 17 00:00:00 2001 From: charlesLoder Date: Sat, 9 Mar 2024 13:11:03 -0500 Subject: [PATCH 2/2] Add logic for only alone --- src/utils/syllabifier.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/utils/syllabifier.ts b/src/utils/syllabifier.ts index 8c09ae6..a031c64 100644 --- a/src/utils/syllabifier.ts +++ b/src/utils/syllabifier.ts @@ -495,9 +495,22 @@ const setIsAccented = (syllable: Syllable) => { } // ole-weyored, the ole does not take the accent, only the "yored" (i.e. a merkha) + // unless the ole is by itself const ole = /\u{05AB}/u; if (ole.test(syllable.text)) { - syllable.isAccented = false; + const yored = /\u{05A5}/u; + let next = syllable.next?.value; + + while (next) { + if (yored.test(next.text)) { + next.isAccented = true; + syllable.isAccented = false; + return; + } + next = (next?.next?.value as Syllable) ?? null; + } + + syllable.isAccented = true; return; }