alef with hamza as in جرات

This commit is contained in:
Bill D 2021-05-30 16:56:31 +04:30
parent b53b0beee6
commit cf01df5c6d
2 changed files with 50 additions and 21 deletions

View File

@ -480,6 +480,25 @@ const diacriticsSections: {
}, },
], ],
}, },
{
describe: "alef with hamza above",
tests: [
{
in: {
p: "جرأت",
f: "jUrát",
},
out: "جُرأت",
},
{
in: {
p: "جرأت",
f: "jUr'át",
},
out: "جُرأت",
},
],
},
{ {
describe: "ayn stuff", describe: "ayn stuff",
tests: [ tests: [
@ -567,8 +586,13 @@ const diacriticsSections: {
}, },
out: "مَعَنا", out: "مَعَنا",
}, },
// طمع - tama // استعمال - istimaal {
// TODO: Starting like عام اعتصاب etc. in: {
p: "طمع استعمال",
f: "tama istimaal",
},
out: "طَمَع اِسْتِعمال",
},
// { // {
// in: { // in: {
// p: "اعتصاب شکن", // p: "اعتصاب شکن",
@ -576,6 +600,13 @@ const diacriticsSections: {
// }, // },
// out: "اِعتِصاب شَکَن", // out: "اِعتِصاب شَکَن",
// }, // },
// {
// in: {
// p: "عادل",
// f: "aadíl",
// },
// out: "عادل",
// },
// // starting with ع // // starting with ع
// { // {
// in: { // in: {
@ -599,21 +630,6 @@ const diacriticsSections: {
// }, // },
// out: "مَعَنا", // out: "مَعَنا",
// }, // },
// ending with ayn
// {
// in: {
// p: "طمع کېدل",
// f: "tama kedul",
// },
// out: "طَمَع کېد" + zwarakey + "ل",
// },
// {
// in: {
// p: "منبع",
// f: "manbí",
// },
// out: "مَنْبِع",
// },
], ],
}, },
{ {

View File

@ -68,6 +68,8 @@ enum PhonemeStatus {
AlefDaggarEnding, AlefDaggarEnding,
LongAinVowelMissingComma, LongAinVowelMissingComma,
ShortAinVowelMissingComma, ShortAinVowelMissingComma,
AlefWithHamza,
AlefWithHamzaWithGlottalStop,
} }
function processPhoneme( function processPhoneme(
@ -94,7 +96,6 @@ function processPhoneme(
phonemeInfo, phonemeInfo,
diacritic, diacritic,
phs, phs,
prevPLetter,
} = stateInfo({ state, i, phoneme, phonemes }); } = stateInfo({ state, i, phoneme, phonemes });
// console.log("phoneme", phoneme); // console.log("phoneme", phoneme);
@ -180,6 +181,12 @@ function processPhoneme(
addP(diacritic), addP(diacritic),
advanceP, advanceP,
)(state) )(state)
: (phs === PhonemeStatus.AlefWithHamza) ?
pipe(
advanceP,
)(state)
: (phs === PhonemeStatus.AlefWithHamzaWithGlottalStop) ?
state
: :
// phs === PhonemeState.ShortVowel // phs === PhonemeState.ShortVowel
pipe( pipe(
@ -245,6 +252,12 @@ function stateInfo({ state, i, phonemes, phoneme }: {
if (phoneme === "-i-" && isBeginningOfWord) { if (phoneme === "-i-" && isBeginningOfWord) {
return PhonemeStatus.Izafe; return PhonemeStatus.Izafe;
} }
if (phoneme === "a" && currentPLetter === "أ") {
return PhonemeStatus.AlefWithHamza;
}
if (phoneme === "'" && nextPhoneme === "a" && currentPLetter === "أ") {
return PhonemeStatus.AlefWithHamzaWithGlottalStop;
}
if (currentPLetter === "ع" && phoneme !== "'" && nextPhoneme !== "'" && phonemeInfo.diacritic && !phonemeInfo.longVowel) { if (currentPLetter === "ع" && phoneme !== "'" && nextPhoneme !== "'" && phonemeInfo.diacritic && !phonemeInfo.longVowel) {
return PhonemeStatus.ShortAinVowelMissingComma; return PhonemeStatus.ShortAinVowelMissingComma;
} }
@ -276,6 +289,6 @@ function stateInfo({ state, i, phonemes, phoneme }: {
const phs = getPhonemeState(); const phs = getPhonemeState();
return { return {
phs, phonemeInfo, diacritic, prevPLetter, phs, phonemeInfo, diacritic,
}; };
}; };