Ejemplo n.º 1
0
def update_translations_list(
        TSE_index="../../indexes/extend",
        translations_list_file="../../resources/configs/translations.js"):
    TSE = TraductionSearchEngine(TSE_index)
    list1 = [item for item in TSE.list_values("id") if item]
    list2 = []
    list3 = []
    for id in list1:
        list2.extend([
            item for item in TSE.list_values("lang", conditions=[("id", id)])
            if item
        ])
        list3.extend([
            item for item in TSE.list_values("author", conditions=[("id", id)])
            if item
        ])
    list5 = map(lambda x: LANGS[x] if LANGS.has_key(x) else x, list2)
    D = {}
    for i in range(len(list3)):
        D[list1[i]] = list5[i] + "-" + list3[i]
    TDICT = json.dumps(D)
    f = open(translations_list_file, "w")
    f.write(TDICT)

    return TDICT
Ejemplo n.º 2
0
def  update_translations_list( TSE_index = "../../indexes/extend", translations_list_file = "../../resources/configs/translations.js" ):
      TSE = TraductionSearchEngine( TSE_index )
      list1 = [item for item in TSE.list_values( "id" ) if item]
      list2 = []
      list3 = []
      for id in list1:
	  list2.extend( [item for item in TSE.list_values( "lang", conditions = [( "id", id )] ) if item] )
	  list3.extend( [item for item in TSE.list_values( "author", conditions = [( "id", id )] ) if item] )
      list5 = map( lambda x: LANGS[x] if LANGS.has_key( x ) else x, list2 )
      D = {}
      for i in range( len( list3 ) ):
	  D[list1[i]] = list3[i] + "-" + list5[i]
      TDICT = json.dumps( D )
      f = open( translations_list_file, "w" )
      f.write( TDICT )

      return TDICT
Ejemplo n.º 3
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#",
        RESULTS = TSE.find_extended( u"gid:1 OR gid:2", defaultfield = "gid" )
        print "\n".join( [str( result ) for result in RESULTS] )

        print "\n#list all translations id#"
        print ",".join( TSE.list_values( "id" ) )



    QUERY1 = "الصلاة+الزكاة"
    # >>الأمل
    # %المأصدة
    # لله
    # ال*لك
    # رب     
    # "رسول * الله"  
    # الصلاة وليس الزكاة
    # #السعير  
    # ~السعير
    # نعمت
    #رقم_السورة:[1 الى 5] و الله 
Ejemplo n.º 4
0
        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]))

        print("\n#list all translations id#")
        print(",".join(TSE.list_values("id")))

    QUERY1 = "الصلاة+الزكاة"
    # >>الأمل
    # %المأصدة
    # لله
    # ال*لك
    # رب
    # "رسول * الله"
    # الصلاة وليس الزكاة
    # #السعير
    # ~السعير
    # نعمت
    #رقم_السورة:[1 الى 5] و الله
    #آية_:'مَن '
    # {ملك,فعل}