How to use the pyarabic.araby.WAW function in PyArabic

To help you get started, we’ve selected a few PyArabic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github linuxscout / mishkal / mishkal / lib / qalsadi / libqutrub / conjugatedisplay.py View on Github external
def highlight_diacritics_html(self, text):
        """
        Highlight dfiactitics in the HTML text.
        @param text: the given text
        @type text: unicode.
        @return: the result as HTML.
        @rtype: unicode.
        """        
        hight_text = u""
        lefttag = u"<span class="tashkeel">"
        righttag = u"</span>"
        for i in range(len(text)):
            if text[i] in (araby.FATHA, araby.DAMMA, araby.KASRA, araby.SUKUN):
                if (i&gt;0 and text[i-1] not in (araby.ALEF, 
                araby.ALEF_HAMZA_ABOVE, araby.WAW_HAMZA, araby.ALEF_MADDA,
                 araby.DAL, araby.THAL, araby.WAW, araby.REH, araby.ZAIN,
            araby.SHADDA)) and (i+1%s"%text[i]
                    hight_text += u"".join([lefttag, " ", text[i], righttag])
            else:
                hight_text += text[i]
        return hight_text
github linuxscout / mishkal / support / libqutrub / conjugatedisplay.py View on Github external
def highlight_diacritics_html(self, text):
        """
        Highlight dfiactitics in the HTML text.
        @param text: the given text
        @type text: unicode.
        @return: the result as HTML.
        @rtype: unicode.
        """        
        hight_text = u""
        lefttag = u"<span class="tashkeel">"
        righttag = u"</span>"
        for i in range(len(text)):
            if text[i] in (araby.FATHA, araby.DAMMA, araby.KASRA, araby.SUKUN):
                if (i&gt;0 and text[i-1] not in (araby.ALEF, 
                araby.ALEF_HAMZA_ABOVE, araby.WAW_HAMZA, araby.ALEF_MADDA,
                 araby.DAL, araby.THAL, araby.WAW, araby.REH, araby.ZAIN,
            araby.SHADDA)) and (i+1%s"%text[i]
                    hight_text += u"".join([lefttag, " ", text[i], righttag])
            else:
                hight_text += text[i]
        return hight_text
github linuxscout / mishkal / mishkal / lib / libqutrub / classverb.py View on Github external
##                       conj_hum=self.conjugate_tense_pronoun(tense,
#                             vconst.PronounHum)
                    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, 
                    conj_huwa+ALEF)
                    if conj_huwa.endswith(KASRA+YEH+FATHA):
                        self.conj_display.add(tense, vconst.PronounHum, 
                        conj_huwa[:-3]+DAMMA+WAW+ALEF)
                    else:
                        self.conj_display.add(tense, vconst.PronounHum, 
                        conj_huwa[:-1]+DAMMA+WAW+ALEF)
            elif tense in (vconst.TenseFuture, vconst.TensePassiveFuture, 
            vconst.TenseJussiveFuture, vconst.TenseSubjunctiveFuture, 
            vconst.TenseConfirmedFuture, vconst.TensePassiveJussiveFuture, 
            vconst.TensePassiveSubjunctiveFuture, 
            vconst.TensePassiveConfirmedFuture):
                conj_ana = self.conjugate_tense_pronoun(tense, 
                vconst.PronounAna)
                self.conj_display.add(tense, vconst.PronounAna, 
                conj_ana)

                conj_anta = self.conjugate_tense_pronoun(tense, 
                vconst.PronounAnta)
                self.conj_display.add(tense, vconst.PronounAnta,
github linuxscout / mishkal / mishkal / lib / libqutrub / classverb.py View on Github external
# هذا يعني وجود حركة طويلة
        # نقوم بتحويل الحركة الطويلة إلى ما يوافقها
        if len(marks) &lt; len(future_marks):
            future_marks = self._homogenize_harakat(marks, future_marks)
            passive_future_marks = self._homogenize_harakat(marks, 
                     passive_future_marks)
        imp_marks = future_marks
        imp_letters = future_letters
        # حالة الأفعال التي تبدأ بألف وصل
        if letters.startswith(ALEF) or self.hamza_zaida:
            future_letters = letters[1:]
            future_marks = future_marks[1:]
            passive_future_marks = passive_future_marks[1:]
            passive_letters = letters[1:]
        # حالة الفعل المثال
        elif self.vlength == 3 and self.word_letters.startswith(WAW) and \
        (self.future_type == KASRA or  (self.future_type==FATHA and \
        self.word_marks==FATHA+FATHA+FATHA and \
        not self.word_letters.endswith(SHADDA))):
            future_letters = letters[1:]
            future_marks = future_marks[1:]
##            passive_future_marks=passive_future_marks[1:]
            passive_letters = letters
        else:
            future_letters = letters
            passive_letters = letters
        new_marks = first_future_mark + future_marks
        passive_marks = first_passive_future_mark + passive_future_marks

        # حالة الأفعال التي تبدأ بألف وصل
        if imp_letters.startswith(ALEF):
            imp_letters = letters[1:]
github linuxscout / alyahmor / alyahmor / verb_affixer.py View on Github external
    @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
github linuxscout / arramooz / scripts / verbs / tagsdict.py View on Github external
def get_verb_info(self, verb_tuple):
        """
        Get verb information
        """

        # get verb subclass
        verb_nm = araby.strip_tashkeel(verb_tuple['vocalized'])
        verb_class = ""
        if verb_nm.startswith(araby.WAW):
            verb_class= "W1W" #"Mithal_W"
        elif verb_nm[-2:-1] ==araby.ALEF: # before last char
            if verb_tuple['future_type'] in (araby.DAMMA, u"ضمة"):
                verb_class= "W2W" #"Adjwaf_W"
            elif verb_tuple['future_type'] in (araby.KASRA, u"كسرة"):
                verb_class= "W2Y" #"Adjwaf_Y"
        elif verb_nm[-1:]  in (araby.YEH, araby.ALEF_MAKSURA): 
            verb_class= "W3Y" #"Naqis_Y"
        elif verb_nm[-1:]  == araby.ALEF: 
            verb_class= "W3W" #"Naqis_W"
        elif araby.SHADDA in (verb_tuple['vocalized']): 
            verb_class= "Dbl" # doubled
        else:
            verb_class = "-"
        
        # the passive tenses dont take object suffix, only with double transitie verbs
github linuxscout / alyahmor / alyahmor / verb_affixer.py View on Github external
        @type proclitic: unicode.
        @param enclitic: first level suffix.
        @type enclitic: unicode.
        @return: (vocalized word, semivocalized).
        @rtype: (unicode, unicode).
        """
        #~ print(verb.encode('utf8'))
        # لمعالجة حالة ألف التفريق
        if enclitic and verb.endswith(ar.WAW + ar.ALEF):
            verb = verb[:-1]
        if enclitic and verb.endswith(ar.ALEF_MAKSURA):
            verb = verb[:-1] + ar.ALEF
        if enclitic and verb.endswith(ar.TEH+ar.DAMMA + ar.MEEM+ ar.SUKUN):
            verb  = verb[:-1] + ar.DAMMA + ar.WAW
        if enclitic and verb.endswith(ar.TEH+ar.DAMMA + ar.MEEM):
            verb += ar.DAMMA + ar.WAW
        word_tuple_list =[]
        #~ enclitic_voc = SVC.COMP_SUFFIX_LIST_TAGS[enclitic]["vocalized"][0]
        #~ enclitic_voc = self.get_enclitic_variant(verb, enclitic_voc)
        #~ proclitic_voc = SVC.COMP_PREFIX_LIST_TAGS[proclitic]["vocalized"][0]
        #suffix_voc = suffix #CONJ_SUFFIX_LIST_TAGS[suffix]["vocalized"][0]
            
        for proclitic_voc in SVC.COMP_PREFIX_LIST_TAGS[proclitic]["vocalized"]:
            for enclitic_voc in SVC.COMP_SUFFIX_LIST_TAGS[enclitic]["vocalized"]:
                enclitic_voc = self.get_enclitic_variant(verb, enclitic_voc)
                vocalized = ''.join([proclitic_voc, verb, enclitic_voc])
                semivocalized = ''.join(
            [proclitic_voc, ar.strip_lastharaka(verb), enclitic_voc])
                word_tuple_list.append((vocalized, semivocalized))
        return word_tuple_list