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",
tests: [
@ -567,8 +586,13 @@ const diacriticsSections: {
},
out: "مَعَنا",
},
// طمع - tama // استعمال - istimaal
// TODO: Starting like عام اعتصاب etc.
{
in: {
p: "طمع استعمال",
f: "tama istimaal",
},
out: "طَمَع اِسْتِعمال",
},
// {
// in: {
// p: "اعتصاب شکن",
@ -576,6 +600,13 @@ const diacriticsSections: {
// },
// out: "اِعتِصاب شَکَن",
// },
// {
// in: {
// p: "عادل",
// f: "aadíl",
// },
// out: "عادل",
// },
// // starting with ع
// {
// in: {
@ -599,21 +630,6 @@ const diacriticsSections: {
// },
// 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,
LongAinVowelMissingComma,
ShortAinVowelMissingComma,
AlefWithHamza,
AlefWithHamzaWithGlottalStop,
}
function processPhoneme(
@ -94,12 +96,11 @@ function processPhoneme(
phonemeInfo,
diacritic,
phs,
prevPLetter,
} = stateInfo({ state, i, phoneme, phonemes });
// console.log("phoneme", phoneme);
// console.log("state", state);
// console.log(phs);
// console.log(phs);
return (phs === PhonemeStatus.LeadingLongVowel) ?
pipe(
@ -180,6 +181,12 @@ function processPhoneme(
addP(diacritic),
advanceP,
)(state)
: (phs === PhonemeStatus.AlefWithHamza) ?
pipe(
advanceP,
)(state)
: (phs === PhonemeStatus.AlefWithHamzaWithGlottalStop) ?
state
:
// phs === PhonemeState.ShortVowel
pipe(
@ -244,7 +251,13 @@ function stateInfo({ state, i, phonemes, phoneme }: {
}
if (phoneme === "-i-" && isBeginningOfWord) {
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) {
return PhonemeStatus.ShortAinVowelMissingComma;
}
@ -276,6 +289,6 @@ function stateInfo({ state, i, phonemes, phoneme }: {
const phs = getPhonemeState();
return {
phs, phonemeInfo, diacritic, prevPLetter,
phs, phonemeInfo, diacritic,
};
};