Comments (1)
Thanks for this question!
I can think of two ways to get the results you need.
Postprocessing
Because the goal is to separate the Latin vowel characters, it may be best to process the transliterated text:
const transliteration = transliterate("אֵל חַי וְקַיָּם תָּמִיד יִמְלֹךְ עָלֵינוּ לְעוֹלָם וָעֶד׃", { customSchema });
// El ḥay vekayam tamid yimloḥ aleynu leolam vaed.
transliteration.split(" ").map(w => {
const twoAdjacentVowels = /([aeiou])([aeiou])/g;
return w.replaceAll(twoAdjacentVowels, "$1'$2");
}).join(" ");
// "El ḥay vekayam tamid yimloḥ aleynu le'olam va'ed."
Additional feature
An additional feature can be used with a callback like this:
const str = `אֵל חַי וְקַיָּם תָּמִיד יִמְלֹךְ עָלֵינוּ לְעוֹלָם וָעֶד׃`;
transliterate(str, {
...customSchema
ADDITIONAL_FEATURES: [
// if you customize your customSchema like I did here
// don't forget the features you already have, or they will get overwritten
{
HEBREW: /[עא]/,
FEATURE: "cluster",
TRANSLITERATION: (cluster, _, schema) => {
const syllable = cluster.syllable;
const onset = syllable.onset;
const clusterText = cluster.text;
// this would mean that the alef or ayin do not contain a vowel
if (onset != "ע" && onset != "א") {
return clusterText;
}
// this would mean that there is no vowel preceding the alef or ayin, thus no need to add an apostrophe
const prevSyllable = syllable.prev?.value;
if (!prevSyllable) {
return clusterText;
}
const key = onset === "ע" ? "AYIN" : "ALEF";
return clusterText.replace(onset, "'" + schema[key]);
}
}
]
});
// el ḥay vekayam tamid yimloḥ alenu le'olam va'ed
The first is less integrated with the rules of the transliteration, but is probably easier to reason about. With the second, I imagine there are quite a few edge cases that could produce incorrect results.
I hope that helps!
from hebrew-transliteration.
Related Issues (20)
- Problem with בִּנְגִינ֗וֹת HOT 1
- Add Tiberian Transcription Schema HOT 153
- Upgrade havarotjs
- Option for `STRESS_MARKER` to be excluded on default accent
- Improve documentation HOT 1
- Add `PASS_THROUGH` option HOT 3
- Paseq has stress marker
- Mid-word coda consonant without shva nah is silent (e.g. "יִשָּׂשכָר") HOT 6
- double marks HOT 4
- Maqqaf after shureq is dropped HOT 2
- SHEVA in Schema HOT 4
- Consider optimizing `ADDITIONAL_FEATURES` HOT 1
- Update furtive patach regex
- `ADDITIONAL_FEATURES` leaving stray shin/sin dot characters HOT 1
- Vocal Shewa HOT 23
- Add Journal of Semitic Studies schema HOT 5
- Add Sephardic IPA schema HOT 2
- Tiberian Jerusalem is incorrect
- Tiberian Issachar
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hebrew-transliteration.