# encoding=utf-8 import unicodecsv from sources.functions import get_index, post_index, numToHeb from sefaria.model.schema import ArrayMapNode, TitledTreeNode day_root, book_root = TitledTreeNode(), TitledTreeNode() with open('psalms_30_day_cycle.csv') as infile: reader = unicodecsv.DictReader(infile) for item in reader: map_node = ArrayMapNode() map_node.add_title('Day {}'.format(item['Day']), 'en', primary=True) map_node.add_title(u'יום {}'.format(numToHeb(item['Day'])), 'he', primary=True) map_node.depth = 0 map_node.includeSections = True map_node.wholeRef = item['Ref'] day_root.append(map_node) with open('psalms_books.csv') as infile: reader = unicodecsv.DictReader(infile) for item in reader: map_node = ArrayMapNode() map_node.add_title('Book {}'.format(item['Book en']), 'en', primary=True) map_node.add_title(u'ספר {}'.format(item['Book he']), 'he', primary=True) map_node.depth = 0
def find_mishlei_info(divrei_hamatchil, proverbs, rb_dict): for mishlei_perek_index, perek in enumerate(proverbs): for mishlei_pasuk_index, pasuk in enumerate(perek): if fuzz.partial_ratio(divrei_hamatchil, pasuk) > 70: return {'perek': functions.numToHeb(mishlei_perek_index+1), 'pasuk': functions.numToHeb(mishlei_pasuk_index+1)}
# encoding=utf-8 import unicodecsv from sources.functions import get_index, post_index, numToHeb from sefaria.model.schema import ArrayMapNode, TitledTreeNode day_root, book_root = TitledTreeNode(), TitledTreeNode() with open('psalms_30_day_cycle.csv') as infile: reader = unicodecsv.DictReader(infile) for item in reader: map_node = ArrayMapNode() map_node.add_title('Day {}'.format(item['Day']), 'en', primary=True) map_node.add_title(u'יום {}'.format(numToHeb(item['Day'])), 'he', primary=True) map_node.depth = 0 map_node.includeSections = True map_node.wholeRef = item['Ref'] day_root.append(map_node) with open('psalms_books.csv') as infile: reader = unicodecsv.DictReader(infile) for item in reader: map_node = ArrayMapNode() map_node.add_title('Book {}'.format(item['Book en']), 'en', primary=True) map_node.add_title(u'ספר {}'.format(item['Book he']), 'he', primary=True) map_node.depth = 0 map_node.includeSections = True map_node.wholeRef = item['Ref'] book_root.append(map_node) p_index = get_index('Psalms') p_index['alt_structs'] = { 'Books': book_root.serialize(),