def transfer_vocalizations( self ): """ load indexed vocalized words from the main index and save them as a list in a dynamic py """ QSE = QuranicSearchEngine( self.__ixpath ) if QSE.OK: mfw = QSE.most_frequent_words( 9999999, "aya_" ) else: mfw = [] V = QArabicSymbolsFilter( \ shaping = False, \ tashkil = True, \ spellerrors = False, \ hamza = False \ ).normalize_all vocalization_dict = {} for w in mfw: word = w[1] if vocalization_dict.has_key( V( word ) ): vocalization_dict[V( word )].append( word ) else: vocalization_dict[V( word )] = [word] raw_str = self.dheader + u"\nvocalization_dict=" + str( vocalization_dict ).replace( ",", ",\n" ) fich = open( self.__dypypath + "vocalizations_dyn.py", "w+" ) fich.write( raw_str ) return raw_str
def transfer_vocalizations(self): """ load indexed vocalized words from the main index and save them as a list in a dynamic py """ QSE = QuranicSearchEngine(self.__ixpath) if QSE.OK: mfw = QSE.most_frequent_words(9999999, "aya_") else: mfw = [] V = QArabicSymbolsFilter( \ shaping = False, \ tashkil = True, \ spellerrors = False, \ hamza = False \ ).normalize_all vocalization_dict = {} for w in mfw: word = w[1] if vocalization_dict.has_key(V(word)): vocalization_dict[V(word)].append(word) else: vocalization_dict[V(word)] = [word] raw_str = self.dheader + u"\nvocalization_dict=" + str( vocalization_dict).replace(",", ",\n") fich = open(self.__dypypath + "vocalizations_dyn.py", "w+") fich.write(raw_str) return raw_str
print "\t", term[1], " - frequence = ", term[0], "." RESULTS, TERMS = QWSE.search_all( "word_id:1", limit = 6236, sortedby = "score", reverse = True ) print len( RESULTS ) print "\n#list field stored VALUES# type" print ",".join( [str( item ) for item in QWSE.list_values( "type" )] ) if QSE.OK: print "\n#most frequent words#" MFW = QSE.most_frequent_words( 9999999, "uth_" ) print len( MFW ) MFW_CSVFILE = open( "./uthmani_vocalized.csv", "w+" ) for term in MFW: pass #print "\t", term[1], " - frequence = ", term[0], "." #print>>MFW_CSVFILE,"\t", term[1]," ;\t",term[0],"\n" print "\n#list field stored values#" print ",".join( [str( item ) for item in QSE.list_values( "gid" )] ) if TSE.OK:
for term in MFW: print("\t", term[1], " - frequence = ", term[0], ".") RESULTS, TERMS = QWSE.search_all("word_id:1", limit=6236, sortedby="score", reverse=True) print(len(RESULTS)) print("\n#list field stored VALUES# type") print(",".join([str(item) for item in QWSE.list_values("type")])) if QSE.OK: print("\n#most frequent words#") MFW = QSE.most_frequent_words(9999999, "uth_") print(len(MFW)) MFW_CSVFILE = open("./uthmani_vocalized.csv", "w+") for term in MFW: pass #print "\t", term[1], " - frequence = ", term[0], "." #print>>MFW_CSVFILE,"\t", term[1]," ;\t",term[0],"\n" print("\n#list field stored values#") print(",".join([str(item) for item in QSE.list_values("gid")])) if TSE.OK: print("\n#extended search#", end='') RESULTS = TSE.find_extended("gid:1 OR gid:2", defaultfield="gid") print("\n".join([str(result) for result in RESULTS]))