isMaddToken static method
Determines if a token is a prolonged vocalic Madd sound (ا, آ, و, ي, ى, ۥ, ۦ, ٰ, ٱ, ٲ).
Implementation
static bool isMaddToken(String tok) {
if (tok.isEmpty) return false;
// Any token carrying an active vowel or consonant mark (Fathah, Dammah, Kasrah, Tanween, Sukoon, Shaddah)
// is an articulated consonant syllable, NOT a pure unvoweled Madd vowel.
for (int i = 0; i < tok.length; i++) {
final int c = tok.codeUnitAt(i);
if (c >= 0x064B && c <= 0x0652) { // ً ٌ ٍ َ ُ ِ ّ ْ
return false;
}
}
// Shaddah doubled consonants (e.g. ييَ, ووَ) without Madd markings are not Madd.
if (isShaddahToken(tok) || isGhunnahToken(tok)) {
return false;
}
for (int i = 0; i < tok.length; i++) {
final int c = tok.codeUnitAt(i);
if (c == 0x0627 || // ا
c == 0x0622 || // آ
c == 0x0648 || // و
c == 0x064A || // ي
c == 0x0649 || // ى
c == 0x0670 || // ٰ
c == 0x0671 || // ٱ
c == 0x06E5 || // ۥ
c == 0x06E6 || // ۦ
c == 0x0672) { // ٲ
return true;
}
}
return false;
}