more work on ain stuff

This commit is contained in:
Bill D 2021-05-28 16:28:59 +04:30
parent aad1b34e17
commit b53b0beee6
2 changed files with 18 additions and 3 deletions

View File

@ -516,8 +516,7 @@ const diacriticsSections: {
p: "بعد",
f: "bad",
},
// TODO: Should this really be an error?
out: null,
out: "بَعد",
},
{
in: {
@ -547,6 +546,13 @@ const diacriticsSections: {
},
out: "مَنْبِعِ",
},
{
in: {
p: "منبع",
f: "manbi",
},
out: "مَنْبِع"
},
{
in: {
p: "معنا",
@ -561,7 +567,6 @@ const diacriticsSections: {
},
out: "مَعَنا",
},
// TODO: Should be allowed to use a short vowel as well
// طمع - tama // استعمال - istimaal
// TODO: Starting like عام اعتصاب etc.
// {

View File

@ -67,6 +67,7 @@ enum PhonemeStatus {
HaEndingWithHeem,
AlefDaggarEnding,
LongAinVowelMissingComma,
ShortAinVowelMissingComma,
}
function processPhoneme(
@ -174,6 +175,11 @@ function processPhoneme(
advanceP,
addP(diacritic)
)(state)
: (phs === PhonemeStatus.ShortAinVowelMissingComma) ?
pipe(
addP(diacritic),
advanceP,
)(state)
:
// phs === PhonemeState.ShortVowel
pipe(
@ -198,6 +204,7 @@ function stateInfo({ state, i, phonemes, phoneme }: {
const isBeginningOfWord = state.pOut === "" || prevPLetter === " ";
const isEndOfWord = !nextPLetter || nextPLetter === " ";
const phonemeInfo = phonemeTable[phoneme];
const nextPhoneme = phonemes[i+1];
const previousPhoneme = i > 0 && phonemes[i-1];
const previousPhonemeInfo = (!isBeginningOfWord && i > 0) && phonemeTable[phonemes[i-1]];
// const nextPhoneme = (phonemes.length > (i + 1)) && phonemes[i+1];
@ -238,6 +245,9 @@ function stateInfo({ state, i, phonemes, phoneme }: {
if (phoneme === "-i-" && isBeginningOfWord) {
return PhonemeStatus.Izafe;
}
if (currentPLetter === "ع" && phoneme !== "'" && nextPhoneme !== "'" && phonemeInfo.diacritic && !phonemeInfo.longVowel) {
return PhonemeStatus.ShortAinVowelMissingComma;
}
if (useAinBlendDiacritics) {
return PhonemeStatus.LongAinVowelMissingComma;
}