charlesLoder / havarotjs

A Typescript package for getting syllabic data about Hebrew text with niqqud.
https://www.npmjs.com/package/havarotjs
MIT License
12 stars 6 forks source link

Incorrect qametsQatan on חָפְשִׁי #173

Closed charlesLoder closed 1 month ago

charlesLoder commented 1 month ago

The qamets in חָפְשִׁי from חֹפֶשׁ should be a qamets qatan, but it is not caught:

const text = new Text("חָפְשִׁ֑י");
const syllables = text.syllables;
const texts = syllables.map((syl) => ({ text: syl.text, vowels: syl.vowelNames }));
// [
//  { text: 'חָ', vowels: [ 'QAMATS' ] },
//  { text: 'פְ', vowels: [ 'SHEVA' ] },
//  { text: 'שִׁ֑י', vowels: [ 'HIRIQ' ] }
// ]

Other words still work, so it's not the qamets qatan logic in general:

const text = new Text("וְאׇזְנַיִם");
const syllables = text.syllables;
const texts = syllables.map((syl) => ({ text: syl.text, vowels: syl.vowelNames }));
// [
//  { text: 'וְ', vowels: [ 'SHEVA' ] },
//  { text: 'אׇזְ', vowels: [ 'QAMATS_QATAN' ] },
//  { text: 'נַ', vowels: [ 'PATAH' ] },
//  { text: 'יִם', vowels: [ 'HIRIQ' ] }
// ]

Interestingly, if חָפְשִׁי precedes a word with a qamets qatan, it is correctly parsed:

const text = new Text("חָפְשִׁ֖י וְאׇזְנַיִם");
const syllables = text.syllables;
const texts = syllables.map((syl) => ({ text: syl.text, vowels: syl.vowelNames }));

// [
//     { text: 'חׇפְ', vowels: [ 'QAMATS_QATAN' ] },
//     { text: 'שִׁ֖י', vowels: [ 'HIRIQ' ] },
//     { text: 'וְ', vowels: [ 'SHEVA' ] },
//     { text: 'אׇזְ', vowels: [ 'QAMATS_QATAN' ] },
//     { text: 'נַ', vowels: [ 'PATAH' ] },
//     { text: 'יִם', vowels: [ 'HIRIQ' ] }
//   ]

My guess is some regex issue