From b1aac313f903b3cba3b008b88345a64ed88afd35 Mon Sep 17 00:00:00 2001 From: Bill D Date: Thu, 3 Jun 2021 20:26:08 +0430 Subject: [PATCH] more --- src/lib/diacritics-helpers.ts | 4 ++++ src/lib/diacritics.test.ts | 4 ++-- src/lib/diacritics.ts | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/lib/diacritics-helpers.ts b/src/lib/diacritics-helpers.ts index 2c6547c..211037c 100644 --- a/src/lib/diacritics-helpers.ts +++ b/src/lib/diacritics-helpers.ts @@ -335,6 +335,7 @@ export enum PhonemeStatus { WoEndingO, ShortAForAlefBeforeFathatan, NOnFathatan, + HamzaOnWow, } export function stateInfo({ state, i, phonemes, phoneme }: { @@ -390,6 +391,9 @@ export function stateInfo({ state, i, phonemes, phoneme }: { if (isBeginningOfWord && phoneme === "u" && prevPLetter === " " && lastNonWhitespace(state.pOut) === "د") { return PhonemeStatus.EndOfDuParticle } + if (phoneme === "a" && previousPhoneme === "U" && currentPLetter === "و") { + return PhonemeStatus.HamzaOnWow; + } if (phoneme === "a" && currentPLetter === "ا" && nextPLetter === fathahan) { return PhonemeStatus.ShortAForAlefBeforeFathatan; } diff --git a/src/lib/diacritics.test.ts b/src/lib/diacritics.test.ts index 79ec8ab..13c7e46 100644 --- a/src/lib/diacritics.test.ts +++ b/src/lib/diacritics.test.ts @@ -803,7 +803,7 @@ const diacriticsSections: { p: "توقع", f: "tawaqqÚ", }, - out: "تَوَقّعُ", + out: "تَوَقُّع", }, ], }, @@ -1050,7 +1050,7 @@ const diacriticsSections: { p: "مودب", f: "mUaddab", }, - out: "مؤدَّب", + out: "مُؤَدَّب", }, ], }, diff --git a/src/lib/diacritics.ts b/src/lib/diacritics.ts index 7b97fdc..65a09cd 100644 --- a/src/lib/diacritics.ts +++ b/src/lib/diacritics.ts @@ -189,7 +189,16 @@ function processPhoneme( pipe( advanceP, )(state) + : (phs === PhonemeStatus.HamzaOnWow) ? + pipe( + advanceP, + addP(hamzaAbove), + addP(diacritic), + )(state) : state; + + + // (phs === PhonemeStatus.AlefWithHamzaWithGlottalStop) ? // state