def run_post_to_api(): #Helper.createBookRecord(book_record()) with open( "preprocess_json/Shraga_Silverstein_translation_on_I_Chronicles.json", 'r') as filep: file_text = filep.read() Helper.postText("II Chronicles", file_text, False)
def run_post_to_api(): Helper.createBookRecord(book_record()) with open("preprocess_json/{}_on_{}.json".format(commentator, masechet), 'r') as filep: file_text = filep.read() mas = re.sub("_", " ", masechet.strip()) Helper.postText("{} on {}".format(commentator, masechet), file_text, False)
def run_post_to_api(chelek): with open("preprocess_json/Noda_Byehuda_I_{}.json".format(chelek), 'r') as filep: file_text = filep.read() try: Helper.postText("Noda Byehuda I, " + chelek, file_text, False) except BadStatusLine as e: print e
def run_post_to_api(): #Helper.createBookRecord(book_record()) with open( "preprocess_json/Shraga_Silverstein_translation_on_{}.json".format( masechet), 'r') as filep: file_text = filep.read() Helper.postText("Mishna " + masechet, file_text, False)
def run_post_to_api(commentator): saved_commetator = re.sub(" ", "_", commentator.strip()) # Helper.createBookRecord(book_record()) with open("../preprocess_json/" + saved_commetator + "_%s.json" % masechet, 'r') as filep: file_text = filep.read() Helper.postText(commentator + "on %s" % masechet, file_text, False)
def run_post_to_api(chelek): chelek1 = re.sub(" ", "_", chelek.strip()) with open("preprocess_json/Terumat_HaDeshen_{}.json".format(chelek1), 'r') as filep: file_text = filep.read() try: Helper.postText("Terumat HaDeshen, " + chelek, file_text, False) except BadStatusLine as e: print e
def post_parsed_text(commentator, book_name): #assemble the title ref commentator_title = unicode(available_commentators[commentator]['record']['title'],'utf-8') ref = commentator_title + ' on ' + book_name dir_name = preprocess_path + commentator with open(dir_name + "/" + ref + ".json", 'r') as filep: file_text = filep.read() Helper.postText(ref, file_text, False)
def post_parsed_text(commentator, book_name): #assemble the title ref commentator_title = unicode( available_commentators[commentator]['record']['title'], 'utf-8') ref = commentator_title + ' on ' + book_name dir_name = preprocess_path + commentator with open(dir_name + "/" + ref + ".json", 'r') as filep: file_text = filep.read() Helper.postText(ref, file_text, False)
def run_post_to_api(sub_directory=None): directory = "preprocess_json/%s" % sub_directory if sub_directory else "preprocess_json" wlc_index_xml = ET.parse("source/TanachIndex.xml") # this lists num of chapters and verses for all books in the WLC books_xml_r = wlc_index_xml.getroot().find("tanach") for book in books_xml_r.findall("book"): canonical_name = book.find("./names/name").text print canonical_name with open("%s/%s.json" % (directory, canonical_name), "r") as filep: file_text = filep.read() sefaria_book = Helper.getKnownTexts(canonical_name) Helper.postText(sefaria_book["title"], file_text, False)
def run_post_to_api(sub_directory=None): directory = "preprocess_json/%s" % sub_directory if sub_directory else "preprocess_json" wlc_index_xml = ET.parse( 'source/TanachIndex.xml' ) #this lists num of chapters and verses for all books in the WLC books_xml_r = wlc_index_xml.getroot().find('tanach') for book in books_xml_r.findall('book'): canonical_name = book.find('./names/name').text print canonical_name with open("%s/%s.json" % (directory, canonical_name), 'r') as filep: file_text = filep.read() sefaria_book = Helper.getKnownTexts(canonical_name) Helper.postText(sefaria_book['title'], file_text, False)
def post_to_api(book_name): index_rec = { "title": 'Ben Ish Chai', "titleVariants": ["Ben Ish Chai"], "heTitle": 'בן איש חי', "heTitleVariants" :['בן איש חי', 'רבי יוסף חיים מבגדאד'], "sectionNames": ["Parsha", "Comment"], "categories": ['Parshanut'], } Helper.createBookRecord(index_rec) dir_name = 'preprocess_json/Ben Ish Chai' with open(dir_name + "/" + book_name + ".json", 'r') as filep: file_text = filep.read() Helper.postText(index_rec["title"], file_text, False)
def post_to_api(book_name): index_rec = { "title": 'Ben Ish Chai', "titleVariants": ["Ben Ish Chai"], "heTitle": 'בן איש חי', "heTitleVariants": ['בן איש חי', 'רבי יוסף חיים מבגדאד'], "sectionNames": ["Parsha", "Comment"], "categories": ['Parshanut'], } Helper.createBookRecord(index_rec) dir_name = 'preprocess_json/Ben Ish Chai' with open(dir_name + "/" + book_name + ".json", 'r') as filep: file_text = filep.read() Helper.postText(index_rec["title"], file_text, False)
def run_post_to_api(record ="shmuel"): if record == "shmuel": b = u"Tiferet_Shmuel_on" a = u"Tiferet Shmuel on " elif record == "yomtov": b= u"Maadaney_Yom_Tov_on" a = u"Maadaney Yom Tov on " elif record == "chamudot": b = u"Divrey_Chamudot_on" a = u"Divrey Chamudot on " # Helper.createBookRecord(book_record()) with open("preprocess_json/" + b + "_%s.json" % masechet, 'r') as filep: file_text = filep.read() Helper.postText( a + "%s" % masechet, file_text, False)
def run_post_to_api(record="shmuel"): if record == "shmuel": b = u"Tiferet_Shmuel_on" a = u"Tiferet Shmuel on " elif record == "yomtov": b = u"Maadaney_Yom_Tov_on" a = u"Maadaney Yom Tov on " elif record == "chamudot": b = u"Divrey_Chamudot_on" a = u"Divrey Chamudot on " # Helper.createBookRecord(book_record()) with open("../preprocess_json/" + b + "_%s.json" % masechet, 'r') as filep: file_text = filep.read() Helper.postText(a + "%s" % masechet, file_text, False)
def save_file(intro): text_whole = { "title": "Haamek Davar Intro", "versionTitle": "", "versionSource": "", "language": "he", "text": intro, } Helper.mkdir_p("preprocess_json/") with open("preprocess_json/Haamek_Davar_intro.json", 'w') as out: json.dump(text_whole, out) with open("preprocess_json/Haamek_Davar_intro.json", 'r') as filep: file_text = filep.read() createBookRecord(intro_basic_record()) Helper.postText("Haamek Davar Intro", file_text, False)
def run_post_to_api(record ="shmuel", part=""): if record == "shmuel": b = u"Tiferet_Shmuel_on" a = u"Tiferet Shmuel on " elif record == "yomtov": b= u"Maadaney_Yom_Tov_on" a = u"Maadaney Yom Tov on " elif record == "chamudot": b = u"Divrey_Chamudot_on" a = u"Divrey Chamudot on " # Helper.createBookRecord(book_record()) if part =="": with open("../preprocess_json/" + b + "_%s.json" % masechet, 'r') as filep: file_text = filep.read() Helper.postText( a + "%s" % masechet, file_text, False) else: #part = re.sub("_"," ",part.strip()) with open("../preprocess_json/" + b + "_{}_{}.json".format(masechet, part), 'r') as filep: file_text = filep.read() Helper.postText( a + "{}, {}".format(masechet,part), file_text, False)
def post_texts(): with open("preprocess_json/Mekhilta DeRashbi.json", 'r') as filep: json_text = filep.read() Helper.postText("Mekhilta DeRabbi Shimon Bar Yochai", json_text, False) with open("preprocess_json/Mekhilta DeRashbi Added.json", 'r') as filep: json_text = filep.read() Helper.postText("Mekhilta DeRabbi Shimon Bar Yochai Additions", json_text, False) with open("preprocess_json/Mekhilta DeRashbi Footnotes 1.json", 'r') as filep: json_text = filep.read() Helper.postText("Footnotes on Mekhilta DeRabbi Shimon Bar Yochai", json_text, False) with open("preprocess_json/Mekhilta DeRashbi Footnotes 2.json", 'r') as filep: json_text = filep.read() Helper.postText("Footnotes on Mekhilta DeRabbi Shimon Bar Yochai Additions", json_text, False)
def run_post_to_api(record="shmuel", part=""): if record == "shmuel": b = u"Tiferet_Shmuel_on" a = u"Tiferet Shmuel on " elif record == "yomtov": b = u"Maadaney_Yom_Tov_on" a = u"Maadaney Yom Tov on " elif record == "chamudot": b = u"Divrey_Chamudot_on" a = u"Divrey Chamudot on " # Helper.createBookRecord(book_record()) if part == "": with open("../preprocess_json/" + b + "_%s.json" % masechet, 'r') as filep: file_text = filep.read() Helper.postText(a + "%s" % masechet, file_text, False) else: #part = re.sub("_"," ",part.strip()) with open( "../preprocess_json/" + b + "_{}_{}.json".format(masechet, part), 'r') as filep: file_text = filep.read() Helper.postText(a + "{}, {}".format(masechet, part), file_text, False)
def post_texts(): with open("preprocess_json/Mekhilta DeRashbi.json", 'r') as filep: json_text = filep.read() Helper.postText("Mekhilta DeRabbi Shimon Bar Yochai", json_text, False) with open("preprocess_json/Mekhilta DeRashbi Added.json", 'r') as filep: json_text = filep.read() Helper.postText("Mekhilta DeRabbi Shimon Bar Yochai Additions", json_text, False) with open("preprocess_json/Mekhilta DeRashbi Footnotes 1.json", 'r') as filep: json_text = filep.read() Helper.postText("Footnotes on Mekhilta DeRabbi Shimon Bar Yochai", json_text, False) with open("preprocess_json/Mekhilta DeRashbi Footnotes 2.json", 'r') as filep: json_text = filep.read() Helper.postText( "Footnotes on Mekhilta DeRabbi Shimon Bar Yochai Additions", json_text, False)
def run_post_to_api(): Helper.createBookRecord(book_record()) with open("preprocess_json/Meshech Hochma.json", 'r') as filep: file_text = filep.read() Helper.postText("Meshech Hochma", file_text, False)
if "-" not in DH: new_dh = re.sub(r"\.", " -", DH, count=1) else: new_dh = DH newLine.append(new_dh) newDaf.append(newLine) newShas.append(newDaf) #except Exception as e: # print "%s did not work" %mas #print newShas[3][0][0] text_whole = { "title": 'Tosafot', "versionTitle": "Wikisource Tosafot", "versionSource": "http://primo.nli.org.il/primo_library/libweb/action/dlDisplay.do?vid=NLI&docId=NNL_ALEPH001300957", "language": "he", "text": newShas, } #save Helper.mkdir_p("preprocess_json/") with open("preprocess_json/Tosafot_on_{}.json".format(mas), 'w') as out: json.dump(text_whole, out) #Helper.createBookRecord(book_record()) with open("preprocess_json/Tosafot_on_%s.json" % mas, 'r') as filep: file_text = filep.read() mas = re.sub("_", " ", mas.strip()) Helper.postText("Tosafot on {}".format(mas), file_text, False)
def run_post_to_api(): Helper.createBookRecord(book_record()) with open("preprocess_json/Haamek_Davar_on_Genesis.json", "r") as filep: file_text = filep.read() Helper.postText("Haamek Davar on Genesis", file_text, False)
def run_post_to_api(): # Helper.createBookRecord(book_record()) with open("preprocess_json/Maharsha_on_%s.json" % masechet, 'r') as filep: file_text = filep.read() Helper.postText("Chidushei Halachot on %s" % masechet, file_text, False)
def run_post_to_api(): Helper.createBookRecord(book_record()) with open("preprocess_json/Rosh_on_Taanit.json", 'r') as filep: file_text = filep.read() Helper.postText("Rosh on Taanit", file_text, False)
def run_post_to_api(): with open("preprocess_json/Haamek_Davar_on_Leviticus.json", 'r') as filep: file_text = filep.read() Helper.postText("Haamek Davar on Leviticus", file_text, False)
def run_post_to_api(): #Helper.createBookRecord(book_record()) with open("preprocess_json/Radak on Genesis.json", 'r') as filep: file_text = filep.read() Helper.postText("Radak on Genesis", file_text, False)
def run_post_to_api(): with open("preprocess_json/Teshuvot_haRambam.json", 'r') as filep: file_text = filep.read() Helper.postText("Teshuvot haRambam", file_text, False)
new_dh = re.sub(ur"\.", " -", DH, count = 1) else: new_dh =DH newLine.append(new_dh) newDaf.append(newLine) newShas.append(newDaf) #except Exception as e: # print "%s did not work" %mas #print newShas[3][0][0] text_whole = { "title": 'Tosafot' , "versionTitle": "Wikisource Tosafot", "versionSource": "http://primo.nli.org.il/primo_library/libweb/action/dlDisplay.do?vid=NLI&docId=NNL_ALEPH001300957", "language": "he", "text": newShas, } #save Helper.mkdir_p("preprocess_json/") with open("preprocess_json/Tosafot_on_{}.json".format(mas), 'w') as out: json.dump(text_whole, out) #Helper.createBookRecord(book_record()) with open("preprocess_json/Tosafot_on_%s.json" %mas, 'r') as filep: file_text = filep.read() mas = re.sub("_"," ", mas.strip()) Helper.postText("Tosafot on {}".format(mas) , file_text, False)
def run_post_to_api(): Helper.createBookRecord(build_index()) with open("preprocess_json/Prisha.json", 'r') as filep: file_text = filep.read() Helper.postText("Prisha, Orach Chaim", file_text, False)
def run_post_to_api(): with open("preprocess_json/Haamek_Davar_on_Deuteronomy.json", 'r') as filep: file_text = filep.read() Helper.postText("Haamek Davar on Deuteronomy", file_text, False)
def run_post_to_api(): with open("preprocess_json/Rashi_on_Genesis.json", 'r') as filep: file_text = filep.read() Helper.postText("Rashi on Genesis", file_text, False)
def run_post_to_api(commentator): saved_commetator = re.sub(" ", "_", commentator.strip()) # Helper.createBookRecord(book_record()) with open("preprocess_json/" + saved_commetator +"_%s.json" % masechet, 'r') as filep: file_text = filep.read() Helper.postText( commentator + "on %s" % masechet, file_text, False)
def run_post_to_api(book): with open("preprocess_json/Daat_Zkenim_on_" + book + ".json", 'r') as filep: file_text = filep.read() Helper.postText("Daat Zkenim on " + book, file_text, False)
def run_post_to_api(): # Helper.createBookRecord(book_record()) with open("preprocess_json/Rosh_on_%s.json" % masechet, 'r') as filep: file_text = filep.read() Helper.postText("Rosh on %s" % masechet, file_text, False)
def run_post_to_api(): #Helper.createBookRecord(book_record()) with open("preprocess_json/Shraga_Silverstein_translation_on_{}.json".format(masechet), 'r') as filep: file_text = filep.read() Helper.postText("Mishna " + masechet , file_text, False)
def run_post_to_api(): Helper.createBookRecord(book_record()) with open("preprocess_json/{}_on_{}.json".format(commentator, masechet), 'r') as filep: file_text = filep.read() mas = re.sub("_"," ", masechet.strip()) Helper.postText("{} on {}".format(commentator, masechet) , file_text, False)
def run_post_to_api(): with open("preprocess_json/Chidushei_Agadot_%s.json" % masechet, 'r') as filep: file_text = filep.read() Helper.postText("Chidushei Agadot on %s" % masechet, file_text, False)
def run_post_to_api(): with open("preprocess_json/Noda_Byehuda.json", 'r') as filep: file_text = filep.read() Helper.postText("Noda Byehuda", file_text, False)
def run_post_to_api(): #Helper.createBookRecord(book_record()) with open("preprocess_json/Shraga_Silverstein_translation_on_I_Chronicles.json", 'r') as filep: file_text = filep.read() Helper.postText("II Chronicles" , file_text, False)
def run_post_to_api(): #Helper.createBookRecord(book_record()) with open("preprocess_json/Haamek_Davar_on_Exodus.json", 'r') as filep: file_text = filep.read() Helper.postText("Haamek Davar on Exodus", file_text, False)