Exemplo n.º 1
0
 def show_page(self, id_page):
     self.all_in_page = self.db.get_text_body(id_page)#rowid, id, text, part, page, hno, sora, aya, na
     if asm_config.getn('tashkil') == 0: now_text = asm_araby.stripHarakat(self.all_in_page[2])
     else: now_text = self.all_in_page[2]
     self.has_commment(id_page)
     titles = self.db.titles_page(self.all_in_page[1])
     ch = self.stack.get_visible_child_name()
     if ch == "n1": 
         self.view_nasse_bfr2.set_text(now_text)
         self.view_nasse_bfr2.insert(self.view_nasse_bfr2.get_end_iter(), " \n")
         try: asm_customs.with_tag(self.view_nasse_bfr2, self.view_title_tag2, titles)
         except: pass 
     else:
         self.view_nasse_bfr1.set_text(now_text)
         self.view_nasse_bfr1.insert(self.view_nasse_bfr1.get_end_iter(), " \n")
         try: asm_customs.with_tag(self.view_nasse_bfr1, self.view_title_tag1, titles)
         except: pass
     self.is_tafsir(self.all_in_page)
     self.current_id = self.all_in_page[0]
     self.ent_page.set_text(str(self.all_in_page[4]))
     self.ent_part.set_text(str(self.all_in_page[3]))
     text = self.parent.entry_search.get_text()
     if len(text) >= 2 and text != "ال": 
         self.search_now(text)
     if len(self.opened_old) == 0: self.opened_old.append(id_page)
     elif id_page != self.opened_old[-1]: self.opened_old.append(id_page)
     self.stack.show_all()
     self.scroll_nasse1.get_vadjustment().set_value(0.0)
     self.scroll_nasse2.get_vadjustment().set_value(0.0)
Exemplo n.º 2
0
 def set_tashkil(self, *a):
     self.show_page(self.all_in_page[1])
     if asm_config.getn('tashkil') == 0: now_text = asm_araby.stripHarakat(self.all_in_page[2])
     else: now_text = self.all_in_page[2]
     ch = self.stack.get_visible_child_name()
     if ch == "n1": 
         self.view_nasse_bfr1.set_text(now_text)
         self.view_nasse_bfr1.insert(self.view_nasse_bfr1.get_end_iter(), " \n")
     else:
         self.view_nasse_bfr2.set_text(now_text)
         self.view_nasse_bfr2.insert(self.view_nasse_bfr2.get_end_iter(), " \n")
Exemplo n.º 3
0
def get_stem(text):
    'return list by all bearable stems'
    if len(text) < 3: return
    stems = []
    if asm_araby.stripTashkeel(text) == u'الله': 
        stems.append(u'الله')
        return stems
    text = asm_araby.stripHarakat(text)
    without_prefix = _del_prefix(text)
    for a in without_prefix:
        without_suffix = _del_suffix(a)
        for b in without_suffix:
            if len(b) <= 9:
                stems.append(b)
    return stems
Exemplo n.º 4
0
def get_root(text):
    roots = []
    if len(text) < 3: return
    text = asm_araby.stripHarakat(text)
    stems = get_stem(text)
    all_term = get_stem(text)
    for a in stems:
        if a[-1] == text[-1] != u"ي":
            text0 = a+u"ي"
            without_augment1 = _del_augment(text0)
            for b in without_augment1:
                if len(b) <= 5 and b not in roots:
                    for c in asm_araby.i3lal(b):
                        all_term.append(c)
                        if is_root(c):
                            if c not in roots:
                                roots.append(c)
        text1, text2 = asm_araby.del_tense(a)
        without_augment1 = _del_augment(text1)
        for b in without_augment1:
            if len(b) <= 5 and b not in roots:
                for c in asm_araby.i3lal(b):
                    all_term.append(c)
                    if is_root(c):
                        if c not in roots:
                            roots.append(c)
                
        if text1 != text2:
            without_augment2 = _del_augment(text2)
            for b in without_augment2:
                if len(b) <= 5 and b not in roots:
                    for c in asm_araby.i3lal(b):
                        all_term.append(c)
                        if is_root(c):
                            if c not in roots:
                                roots.append(c)
    return roots, all_term