Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@staticmethod
def get_in_stem_variants(stem, enclitic):
""" return modified forms of input stem"""
list_stem = []
if enclitic:
if stem.endswith(ar.TEH + ar.MEEM + ar.WAW):
list_stem.append(stem[:-1])
elif stem.endswith(ar.WAW):
list_stem.append(stem + ar.ALEF)
elif stem.endswith(ar.ALEF):
list_stem.append(stem[:-1] + ar.ALEF_MAKSURA)
if stem.startswith(ar.ALEF_MADDA):
# االبداية بألف مد
list_stem.append(ar.ALEF_HAMZA_ABOVE + \
ar.ALEF_HAMZA_ABOVE + stem[1:])
list_stem.append(ar.HAMZA + ar.ALEF + stem[1:])
return list_stem
@staticmethod
Determine if the verb starts with Hamza and the Teh is not
@param verb_normalized_unvocalized: the unvovalized form f the verb.
@type verb_normalized_unvocalized: unicde
@return: return True if the start Teh is not original
@rtype: boolean;
"""
# if the lenght of verb is exactely 4 letters and starts by hamza
# and it is in the AF3Al wazn and not FA33al or FAA3la
# ألوزن المعني هو أفعل
# الأوزان غير المعنية هي فاعل وفعّل
# الأوزان المشتقة هي أفعّ من أفعل
# الخلاصة أن يكون الفعل رباعيا، حرفه الأول همزة
# ولا يكون حرفه الثاني ألف، لمنع الوزن فاعل
# ولا يكون حرفه الثالث شدة، لمنع الوزن فعّل
verb = verb_normalized_unvocalized
if len(verb) != 4 or not verb.startswith(HAMZA):
return False
elif len(verb) == 4 and verb.startswith(HAMZA) and \
verb[1]!=ALEF and verb[2]!=SHADDA:
return True
else :
return False
Determine if the verb starts with Hamza and the Teh is not
@param verb_normalized_unvocalized: the unvovalized form f the verb.
@type verb_normalized_unvocalized: unicde
@return: return True if the start Teh is not original
@rtype: boolean;
"""
# if the lenght of verb is exactely 4 letters and starts by hamza
# and it is in the AF3Al wazn and not FA33al or FAA3la
# ألوزن المعني هو أفعل
# الأوزان غير المعنية هي فاعل وفعّل
# الأوزان المشتقة هي أفعّ من أفعل
# الخلاصة أن يكون الفعل رباعيا، حرفه الأول همزة
# ولا يكون حرفه الثاني ألف، لمنع الوزن فاعل
# ولا يكون حرفه الثالث شدة، لمنع الوزن فعّل
verb = verb_normalized_unvocalized
if len(verb) != 4 or not verb.startswith(HAMZA):
return False
elif len(verb) == 4 and verb.startswith(HAMZA) and \
verb[1]!=ALEF and verb[2]!=SHADDA:
return True
else :
return False
@type verb_normalized_unvocalized: unicde
@return: return True if the start Teh is not original
@rtype: boolean;
"""
# if the lenght of verb is exactely 4 letters and starts by hamza
# and it is in the AF3Al wazn and not FA33al or FAA3la
# ألوزن المعني هو أفعل
# الأوزان غير المعنية هي فاعل وفعّل
# الأوزان المشتقة هي أفعّ من أفعل
# الخلاصة أن يكون الفعل رباعيا، حرفه الأول همزة
# ولا يكون حرفه الثاني ألف، لمنع الوزن فاعل
# ولا يكون حرفه الثالث شدة، لمنع الوزن فعّل
verb = verb_normalized_unvocalized
if len(verb) != 4 or not verb.startswith(HAMZA):
return False
elif len(verb) == 4 and verb.startswith(HAMZA) and \
verb[1]!=ALEF and verb[2]!=SHADDA:
return True
else :
return False
CONVERSION_TABLE = {
ALEF_YEH_HARAKA: KASRA,
ALEF_WAW_HARAKA: DAMMA,
WAW_HARAKA: DAMMA,
YEH_HARAKA : KASRA,
ALTERNATIVE_YEH_HARAKA: DAMMA,
}
##WAW_MAKSURA = WAW
#HARAKAT = u"%s%s%s%s%s"%(SUKUN, FATHA, DAMMA, KASRA, SHADDA)
HARAKAT = (SUKUN, FATHA, DAMMA, KASRA)
HARAKAT2 = u"".join([ALEF_HARAKA, WAW_HARAKA, YEH_HARAKA, SUKUN,
FATHA, DAMMA, KASRA])
HAMZAT_PATTERN = re.compile(u"[%s%s%s%s%s]"%(ALEF_HAMZA_ABOVE, WAW_HAMZA,
YEH_HAMZA , HAMZA, ALEF_HAMZA_BELOW), re.UNICODE)
HAMZAT = (ALEF_HAMZA_ABOVE, WAW_HAMZA, YEH_HAMZA , HAMZA, ALEF_HAMZA_BELOW)
LAM_ALEF_PAT = re.compile(u'[\ufef7\ufef9\ufef5]', re.UNICODE)
#uniformate harkat
UNIFORMATE_MARKS_4 = FATHA+SUKUN+FATHA+FATHA
UNIFORMATE_MARKS_5TEH = FATHA+FATHA+SUKUN+FATHA+FATHA
UNIFORMATE_MARKS_5 = KASRA+SUKUN+FATHA+FATHA+FATHA
UNIFORMATE_MARKS_6 = KASRA+SUKUN+FATHA+SUKUN+FATHA+FATHA
BEGIN_WORD = u"^"
END_WORD = u"$"
LONG_HARAKAT = (ALEF_HARAKA, YEH_HARAKA, WAW_HARAKA, ALEF_YEH_HARAKA,
ALEF_WAW_HARAKA)
_F = FATHA
_W = WAW_HARAKA
_Y = YEH_HARAKA
_AH = ALEF_HARAKA
_YH = YEH_HARAKA
_WH = WAW_HARAKA
_AYH = ALEF_YEH_HARAKA
_AWH = ALEF_WAW_HARAKA
_YHALT = ALTERNATIVE_YEH_HARAKA
#HAMZAT
_AHA = ALEF_HAMZA_ABOVE
_AHB = ALEF_HAMZA_BELOW
_AM = ALEF_MADDA
_YHA = YEH_HAMZA
_WHA = WAW_HAMZA
_HZ = HAMZA
INITIAL_TAHMEEZ_TABLE = {_S:_HZ, _F:_AHA, _D:_AHA, _K:_AHB, _AH:_AM ,
_WH:_AHA, _YH:_AHB, _YHALT:_AHB}
MIDDLE_TAHMEEZ_TABLE = {
_S: {_S:_HZ, _F:_AHA, _D:_WHA, _K:_YHA, _AH:_AHA, _WH:_WHA, _YH:_YHA },
_F: {_S:_AHA, _F:_AHA, _D:_WHA, _K:_YHA, _AH:_AHA, _WH:_WHA, _YH:_YHA },
_D: {_S:_WHA, _F:_WHA, _D:_WHA, _K:_YHA, _AH:_WHA, _WH:_WHA, _YH:_YHA },
_K: {_S:_YHA, _F:_YHA, _D:_YHA, _K:_YHA, _AH:_YHA, _WH:_YHA, _YH:_YHA },
_AH: {_S:_HZ, _F:_HZ, _D:_WHA, _K:_YHA, _AH:_HZ, _WH:_WHA, _YH:_YHA },
_WH: {_S:_HZ, _F:_HZ, _D:_WHA, _K:_YHA, _AH:_HZ, _WH:_WHA, _YH:_YHA },
_YH: {_S:_YHA, _F:_YHA, _D:_YHA, _K:_YHA, _AH:_YHA, _WH:_YHA, _YH:_YHA },
}
conj_ana+MEEM)
elif pronoun == vconst.PronounAntunna:
self.conj_display.add(tense, vconst.PronounAntunna,
conj_ana+NOON+SHADDA+FATHA)
# indirect conjugation
# Ana pronoun like conjugation
elif pronoun in ( vconst.PronounHya, vconst.PronounHuma_f,
vconst.PronounHuma, vconst.PronounHum):
conj_huwa = self.conj_display.get_conj(tense,
vconst.PronounHuwa)
if conj_huwa == u"":
conj_huwa = self.conjugate_tense_pronoun(tense,
vconst.PronounHuwa)
self.conj_display.add(tense, vconst.PronounHuwa, conj_huwa)
# حالة الفعل مهموز الآخر
if conj_huwa.endswith(YEH+HAMZA+FATHA) :
self.conj_display.add(tense, vconst.PronounHya,
conj_huwa[:-2]+YEH_HAMZA+FATHA+TEH+SUKUN)
self.conj_display.add(tense, vconst.PronounHuma_f,
conj_huwa[:-2]+YEH_HAMZA+FATHA+TEH+FATHA+ALEF)
self.conj_display.add(tense, vconst.PronounHuma,
conj_huwa[:-2]+YEH_HAMZA+FATHA+ALEF)
self.conj_display.add(tense, vconst.PronounHum,
conj_huwa[:-2]+YEH_HAMZA+DAMMA+WAW+ALEF)
else :
self.conj_display.add(tense, vconst.PronounHya,
conj_huwa+TEH+SUKUN)
self.conj_display.add(tense, vconst.PronounHuma_f,
conj_huwa+TEH+FATHA+ALEF)
self.conj_display.add(tense, vconst.PronounHuma,