def get_model(self): list_store = Gtk.ListStore(str) db_list = os.listdir("dict") result_all = "" for db in db_list: db_name = os.path.splitext(db)[0] wlooker = WordsListLooker(None, "dict/" + db) wlooker.searchKey = self.entry_keyword.get_text() if not araby.isArabicword(unicode(wlooker.searchKey)): Result = '<p dir="ltr"><font color="blue">' + db_name + "</font></p>" + '<html dir="rtl">' for row in wlooker.lookup(): list_store.append([row[0]]) Result = Result + "<br />" + row[1] else: Result = '<p dir="ltr"><font color="blue"><b>' + db_name + "</b></font></p>" for row in wlooker.lookup(): list_store.append([row[1]]) Result = Result + "<br />" + row[0] result_all = result_all + Result self.view.load_string(result_all, "text/html", "UTF-8", "www.example.com") return list_store
def extract(word): """ """ #print word.encode('utf8'); if araby.isArabicword(word): print araby.stripLastHaraka(word).encode('utf8');
@param word: input text. @type word: unicode. @return: True if word is accepted rtype: boolean. """ result = self.analyzer.check_word(word); if result: # result has many cases if len(result)>1: return True; #one only case else : return not result[0].isUnknown(); return False; if __name__=="__main__": print "test"; myrepr=arabRepr.ArabicRepr(); speller=SpellcheckClass(); text=u" اللغه العربيه" voc = speller.spellcheck(text, True); # print myrepr.repr(voc).encode('utf8') for itemd in voc: if itemd.get('suggest','') !='': for sug in itemd.get('suggest','').split(';'): print sug.encode('utf8'),'\t', araby.isArabicword(sug);
def extract(word): """ """ #print word.encode('utf8'); if araby.isArabicword(word): print araby.stripLastHaraka(word).encode('utf8')