Exemplo n.º 1
0
    def test_waznlike(self):

        # waznlike(word1, wazn):
        word1 = u"ضارب"
        wazn = u"فَاعِل"
        wazn1 = u"فعال"
        self.assertTrue(Araby.waznlike(word1, wazn))
        self.assertFalse(Araby.waznlike(word1, wazn1))
Exemplo n.º 2
0
def attach_sheme(combos):
    """Filtre les compositions extraites de la fonction découpage() pour donner en sortie les compositions qui
    accéptent l'un des shémes de la BDD. La sortie est une liste de dictionnaires ou chaque dictionnaire est une
    composition avec un champs supplémentaire : le shéme adéquat. """
    good_sheme_comb = []
    for comb in combos:
        # for pat in Pattern.objects.filter(unvoweled_form__length=len(comb['Base'])):
        for pat in Pattern.objects.all():
            if araby.waznlike(comb['Base'], pat.voweled_form):
                if comb['Préfixe'] != '' and ((comb['Préfixe'].classe[0] == 'N'
                                               and pat.ntype == 'unspec') or
                                              (comb['Préfixe'].classe[0] == 'V'
                                               and pat.vtype == 'unspec')):
                    continue
                if comb['Suffixe'] != '' and ((comb['Suffixe'].classe[0] == 'N'
                                               and pat.ntype == 'unspec') or
                                              (comb['Suffixe'].classe[0] == 'V'
                                               and pat.vtype == 'unspec')):
                    continue
                else:
                    if pat.vtype != 'unspec':
                        stype = pat.vtype
                    else:
                        stype = pat.ntype
                    good_sheme_comb.append({
                        'Base': comb['Base'],
                        'Préfixe': comb['Préfixe'],
                        'Suffixe': comb['Suffixe'],
                        'pattern': pat,
                        'type': pat.ptype,
                        'stype': stype
                    })
    return good_sheme_comb
Exemplo n.º 3
0
 def test_waznlike(self):
     """Test if wazn like?"""
     word = u"ضارب"
     wazn = u"فَاعِل"
     self.assertTrue(ar.waznlike(word, wazn))
Exemplo n.º 4
0
 def test_waznlike(self):
     """Test if wazn like?"""
     word = u"ضارب"
     wazn = u"فَاعِل"
     self.assertTrue(ar.waznlike(word, wazn))
Exemplo n.º 5
0
        index = listWords.index(word)
        listWords[index] = word1

    if word == u'أنا' or word == u'انا':
        #drop harf alef
        word1 = word.replace(araby.last_char(word), u'')
        index = listWords.index(word)
        listWords[index] = word1

    if word == u'مائة':
        #drop harf alef
        word1 = word.replace(araby.second_char(word), u'')
        index = listWords.index(word)
        listWords[index] = word1

    if (araby.waznlike(word, u'يفعلوا') or araby.waznlike(word, u'افعلوا')
            or araby.waznlike(word, u'فعلوا')) and (araby.last_char(word)
                                                    == u'ا'):
        #drop harf alef
        word1 = word.replace(araby.last_char(word), u'')
        index = listWords.index(word)
        listWords[index] = word1

    if word in asmaaIshara:
        #replace the third char with ا iza kan al7arf al tani harakih w iza la bnbaddil il harf altani
        if araby.is_haraka(araby.second_char(word)):
            #replace the third char
            #word1 = araby.first_char(ss) + u'ا'+ ss[1:]
            index = listWords.index(word)
            listWords[index] = word1
        else: