charlesLoder / havarotjs

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

Structure misses furtive patach followed by sof pasuq #115

Closed charlesLoder closed 1 year ago

charlesLoder commented 1 year ago

The structure method accounts for furtive patach, but misses when there is a sof pasuq at the end.

Basically, "רֽוּחַ׃" may be the most complicated word to syllabify.

Example:

const str = "רֽוּחַ׃";
const text = new Text(str);
text.syllables.forEach((s) => {
  const [a, b, c] = [...s.structure()];
  console.log({
    onset: a,
    nucleus: b,
    coda: c
  });
});

// { onset: 'ר', nucleus: '', coda: 'ֽוּ' } this is incorrect as well, but will be addressed in another issue
// { onset: 'ח', nucleus: 'ַ', coda: '׃' }

Should be

// { onset: 'ר', nucleus: '', coda: 'ֽוּ' } see note above
// { onset: '', nucleus: 'ַ', coda: 'ח׃' }

This is because the syllabifier does not handled punctuation correctly.