Skip to content

Commit

Permalink
Merge pull request #162 from charlesLoder/ole-alone
Browse files Browse the repository at this point in the history
Add logic for only alone
  • Loading branch information
charlesLoder authored Mar 9, 2024
2 parents 0a4f082 + 6ed5cb6 commit 402ad11
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
15 changes: 14 additions & 1 deletion src/utils/syllabifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
12 changes: 9 additions & 3 deletions test/syllable.isAccented.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down

0 comments on commit 402ad11

Please sign in to comment.