def divrey_chamuot(parsed_text): chamudotlinks = [] count = 0 file = tiferet_shmuel.open_file(record="chamudot") parsed = tiferet_shmuel.parse(file) Helper.createBookRecord(tiferet_shmuel.book_record(record="chamudot")) tiferet_shmuel.save_parsed_text(parsed, record="chamudot") tiferet_shmuel.run_post_to_api(record="chamudot") for k, perek in enumerate(parsed_text): for i, seif in enumerate(perek): for j, siman in enumerate(seif): #if re.match('\(.\)', siman): if ur'(*)' in siman: print ur"הגעתי לכאן!" a = re.findall('\(\*\)', siman) for b in a: print siman count += 1 roash = "Rosh on %s." % masechet + str( k + 1) + "." + str(i + 1) + "." + str(j + 1) shmuel = "Divrey Chamudot on " + masechet + "." + str( count) chamudotlinks.append(link(roash, shmuel)) print count print roash, shmuel
def divrey_chamuot2(text): chamudotlinks = [] count = 0 file = tiferet_shmuel.open_file(record="chamudot") parsed = tiferet_shmuel.parse(file) Helper.createBookRecord(tiferet_shmuel.book_record(record="chamudot")) tiferet_shmuel.save_parsed_text(parsed, record="chamudot") tiferet_shmuel.run_post_to_api(record="chamudot") commentator = "Divrey Chamudot" rosh = [] chapters = re.split(ur'(?:@00|@99)', text) for chapter_num, chapter in zip(chapters[1::2], chapters[2::2]): print chapter_num if len(chapter) <= 1: pass else: perek = [] a = re.split(ur'@22([^@]*)', chapter) for seif, cont in zip(a[1::2], a[2::2]): si = [] print seif if ur'(*)' in seif: print "hello1" if ur'(*)' in seif: count += 1 roash = "Rosh on %s." % masechet + str( len(rosh) + 1) + "." + str(len(perek) + 1) + ".1" shmuel = commentator + " on " + masechet + "." + str(count) chamudotlinks.append(link(roash, shmuel)) print roash, shmuel content = re.split('@66', cont) seif = re.sub(ur'[^א-ת]', "", seif) seif = hebrew.heb_string_to_int(seif.strip()) for num, co in enumerate(content): a = re.findall('\(\*\)', co) for b in a: count += 1 roash = "Rosh on %s." % masechet + str( len(rosh) + 1) + "." + str(len(perek) + 1) + "." + str(num + 1) shmuel = commentator + " on " + masechet + "." + str( count) print roash, shmuel chamudotlinks.append(link(shmuel, roash)) #print parsed[count] si.append(co) perek.append(si) rosh.append(perek)
def divrey_chamuot2(text): chamudotlinks = [] count = 0 file = tiferet_shmuel.open_file(record = "chamudot") parsed = tiferet_shmuel.parse(file) Helper.createBookRecord(tiferet_shmuel.book_record(record = "chamudot")) tiferet_shmuel.save_parsed_text(parsed, record = "chamudot") tiferet_shmuel.run_post_to_api(record = "chamudot") commentator = "Divrey Chamudot" rosh = [] chapters = re.split(ur'(?:@00|@99)', text) for chapter_num, chapter in zip(chapters[1::2], chapters[2::2]): print chapter_num if len(chapter)<=1: pass else: perek = [] a = re.split(ur'@22([^@]*)', chapter) for seif, cont in zip(a[1::2], a[2::2]): si = [] print seif if ur'(*)' in seif: print "hello1" if ur'(*)' in seif: count+=1 roash = "Rosh on %s." % masechet +str(len(rosh)+1) + "." + str(len(perek)+1) + ".1" shmuel = commentator + " on " + masechet +"."+ str(count) chamudotlinks.append(link(roash, shmuel)) print roash, shmuel content = re.split('@66', cont) seif = re.sub(ur'[^א-ת]',"", seif) seif = hebrew.heb_string_to_int(seif.strip()) for num, co in enumerate(content): a = re.findall('\(\*\)', co) for b in a: count+=1 roash = "Rosh on %s." % masechet + str(len(rosh)+1) + "." + str(len(perek)+1) + "." + str(num+1) shmuel = commentator + " on " + masechet + "." + str(count) print roash, shmuel chamudotlinks.append(link(shmuel, roash)) #print parsed[count] si.append(co) perek.append(si) rosh.append(perek)
def link_tiferet_shmuel(parsed_text): shmuellinks = [] count = 0 file = tiferet_shmuel.open_file() parsed = tiferet_shmuel.parse(file) Helper.createBookRecord(tiferet_shmuel.book_record()) tiferet_shmuel.save_parsed_text(parsed) tiferet_shmuel.run_post_to_api() for k, perek in enumerate(parsed_text): for i, seif in enumerate(perek): for j, siman in enumerate(seif): #if re.match('\(.\)', siman): if ur'(*)' in siman: a = re.findall('\(. \)', siman) for b in a: print siman count +=1 roash = "Rosh on %s." % masechet + str(k+2) + "." + str(i+1) + "." + str(j+1) shmuel = "Tiferet Shmuel on " + masechet + "." + str(count) shmuellinks.append(link(roash, shmuel)) print count
def maadaney_yom_tov(parsed_text): yomtovlinks = [] count = 0 file = tiferet_shmuel.open_file1() parsed = tiferet_shmuel.parse(file) Helper.createBookRecord(tiferet_shmuel.book_record(record = "yomtov")) tiferet_shmuel.save_parsed_text(parsed, record = "yomtov") tiferet_shmuel.run_post_to_api(record = "yomtov") for k, perek in enumerate(parsed_text): for i, seif in enumerate(perek): for j, siman in enumerate(seif): #print siman #if re.match('\(.\)', siman): if ur'[*]' in siman: #print ur"הגעתי לכאן!" a = re.findall('\[\*\]', siman) for b in a: # print siman count +=1 roash = "Rosh on %s." % masechet + str(k+1) + "." + str(i+1) + "." + str(j+1) shmuel = "Maadaney Yom Tov on " + masechet + "." + str(count) yomtovlinks.append(link(roash, shmuel))
def link_tiferet_shmuel(parsed_text): shmuellinks = [] count = 0 file = tiferet_shmuel.open_file(record = "chamudot") parsed = tiferet_shmuel.parse(file) clean = complex_tiferet_shmuel.clean(parsed) complex_tiferet_shmuel.book_record(record = "chamudot") tiferet_shmuel.save_parsed_text(clean) tiferet_shmuel.run_post_to_api(record = "chamudot") for k, perek in enumerate(parsed_text): for i, seif in enumerate(perek): for j, siman in enumerate(seif): #if re.match('\(.\)', siman): if ur'(*)' in siman: #print ur"הגעתי לכאן!" a = re.findall('\(\*\)', siman) for b in a: #print siman count +=1 roash = "Rosh on %s." % masechet + str(k+1) + "." + str(i+1) + "." + str(j+1) shmuel = "Divrey Chamudot on " + masechet + "." + str(count) shmuellinks.append(link(roash, shmuel))
def divrey_chamuot(parsed_text): chamudotlinks = [] count = 0 file = tiferet_shmuel.open_file(record = "chamudot") parsed = tiferet_shmuel.parse(file) Helper.createBookRecord(tiferet_shmuel.book_record(record = "chamudot")) tiferet_shmuel.save_parsed_text(parsed, record = "chamudot") tiferet_shmuel.run_post_to_api(record = "chamudot") for k, perek in enumerate(parsed_text): for i, seif in enumerate(perek): for j, siman in enumerate(seif): #if re.match('\(.\)', siman): if ur'(*)' in siman: print ur"הגעתי לכאן!" a = re.findall('\(\*\)', siman) for b in a: print siman count +=1 roash = "Rosh on %s." % masechet + str(k+1) + "." + str(i+1) + "." + str(j+1) shmuel = "Divrey Chamudot on " + masechet + "." + str(count) chamudotlinks.append(link(roash, shmuel)) print count print roash, shmuel
def maadaney_yom_tov(parsed_text): yomtovlinks = [] count = 0 file = tiferet_shmuel.open_file1() parsed = tiferet_shmuel.parse(file) Helper.createBookRecord(tiferet_shmuel.book_record(record="yomtov")) tiferet_shmuel.save_parsed_text(parsed, record="yomtov") tiferet_shmuel.run_post_to_api(record="yomtov") for k, perek in enumerate(parsed_text): for i, seif in enumerate(perek): for j, siman in enumerate(seif): #print siman #if re.match('\(.\)', siman): if ur'[*]' in siman: #print ur"הגעתי לכאן!" a = re.findall('\[\*\]', siman) for b in a: # print siman count += 1 roash = "Rosh on %s." % masechet + str( k + 1) + "." + str(i + 1) + "." + str(j + 1) shmuel = "Maadaney Yom Tov on " + masechet + "." + str( count) yomtovlinks.append(link(roash, shmuel))