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

View File

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