コード例 #1
0
ファイル: upload.py プロジェクト: maxrabin/Sefaria-Data
def shulchan_arukh_index(server='http://localhost:8000', *args, **kwargs):
    original_index = functions.get_index_api("Shulchan Arukh, Orach Chayim",
                                             server=server)
    original_index['alt_structs'] = {
        'Topic': get_alt_struct("Shulchan Arukh, Orach Chayim")
    }
    return original_index
コード例 #2
0
def shulchan_arukh_index(server='http://localhost:8000', *args, **kwargs):
    original_index = functions.get_index_api(u"Shulchan Arukh, Yoreh De'ah",
                                             server=server)
    alt_struct = get_alt_struct(u"Shulchan Arukh, Yoreh De'ah")
    if 'alt_structs' not in original_index:
        original_index['alt_structs'] = {}
    original_index['alt_structs']['Topic'] = alt_struct
    return original_index
コード例 #3
0
ファイル: upload.py プロジェクト: JonMosenkis/Sefaria-Data
def shulchan_arukh_index(server='http://localhost:8000', *args, **kwargs):
    original_index = functions.get_index_api("Shulchan Arukh, Orach Chayim", server=server)
    original_index['alt_structs'] = {'Topic': get_alt_struct("Shulchan Arukh, Orach Chayim")}
    return original_index
コード例 #4
0
ファイル: alt_toc.py プロジェクト: maxrabin/Sefaria-Data
from sefaria.helper.schema import migrate_to_complex_structure
if __name__ == "__main__":
    files = [f for f in os.listdir('.') if f.endswith(".csv")]
    nodes = []
    for f in files:
        schema = SchemaNode()
        en_title = f.replace(".csv", "")
        he_title = library.get_index(en_title).get_title('he')
        schema.add_primary_titles(en_title, he_title)
        reader = UnicodeReader(open(f))
        for row in reader:
            he, en, first, last = row
            node = ArrayMapNode()
            node.add_primary_titles(en, he)
            node.depth = 0
            node.wholeRef = "Arukh HaShulchan, {} {}-{}".format(en_title, first, last)
            node.refs = []
            schema.append(node)
        nodes.append(schema.serialize())

    index = get_index_api("Arukh HaShulchan", server="http://draft.sefaria.org")
    index['alt_structs'] = {"Subject": {"nodes": nodes}}
    # post_index(index, server="http://draft.sefaria.org")
    mapping = {
        "Arukh HaShulchan 1": "Arukh HaShulchan, Orach Chaim",
        "Arukh HaShulchan 2": "Arukh HaShulchan, Yoreh Deah",
        "Arukh HaShulchan 3": "Arukh HaShulchan, Even HaEzer",
        "Arukh HaShulchan 4": "Arukh HaShulchan, Choshen Mishpat"
    }

    migrate_to_complex_structure("Arukh HaShulchan", mapping)
コード例 #5
0
import django
django.setup()
from sefaria.model import *
from sources.functions import get_index_api, post_index, post_category

if __name__ == "__main__":
    SERVER = "https://www.sefaria.org"
    # c = Category()
    # c.path = ["Tanakh", "Commentary", "Joseph ibn Yahya"]
    # c.add_shared_term("Joseph ibn Yahya")
    # c.save()
    # post_category(c.contents(), server=SERVER)
    #
    # c = Category()
    # c.path = ["Tanakh", "Commentary", "Joseph ibn Yahya", "Writings"]
    # c.add_shared_term("Writings")
    # c.save()
    # post_category(c.contents(), server=SERVER)

    index = get_index_api("Joseph ibn Yahya on Esther", server=SERVER)
    index["categories"] = ["Tanakh", "Commentary", "Joseph ibn Yahya", "Writings"]
    post_index(index, server=SERVER)
コード例 #6
0
ファイル: upload.py プロジェクト: maxrabin/Sefaria-Data
def shulchan_arukh_index(server='http://localhost:8000', *args, **kwargs):
    original_index = get_index_api("Shulchan Arukh, Choshen Mishpat",
                                   server=server)
    alt_struct = get_alt_struct("Shulchan Arukh, Choshen Mishpat")
    original_index['alt_structs'] = {'Topic': alt_struct}
    return original_index
コード例 #7
0
import django
django.setup()
from sefaria.model import *
from bs4 import BeautifulSoup
from sources.functions import get_index_api, post_index
file = open("alt_struct_sichot_avodat_levi.xml")
soup = BeautifulSoup(file)
nodes = []
index = get_index_api("Sichot Avodat Levi", server="http://draft.sefaria.org")
elements = [el for el in soup.find("opml").contents[3:] if el != "\n"]
for el in elements:
    parsha_he, parsha_en = el.attrs["text"].split(" / ")
    parsha_node = SchemaNode()
    parsha_node.add_primary_titles(parsha_en, parsha_he)
    for child in [child for child in el.contents if child != "\n"]:
        he, en = child.attrs["text"].split(" / ")
        ref = en.replace("Section ", "")
        child_node = ArrayMapNode()
        child_node.add_primary_titles(en, he)
        child_node.depth = 0
        child_node.refs = []
        child_node.wholeRef = "Sichot Avodat Levi {}".format(ref)
        parsha_node.append(child_node)
    parsha_node.validate()
    nodes.append(parsha_node.serialize())
index["alt_structs"] = {"Parasha": {"nodes": nodes}}
post_index(index, server="http://draft.sefaria.org")


コード例 #8
0
import django

django.setup()
from sefaria.model import *
from bs4 import BeautifulSoup
from sources.functions import get_index_api, post_index

file = open("alt_struct_sichot_avodat_levi.xml")
soup = BeautifulSoup(file)
nodes = []
index = get_index_api("Sichot Avodat Levi", server="http://draft.sefaria.org")
elements = [el for el in soup.find("opml").contents[3:] if el != "\n"]
for el in elements:
    parsha_he, parsha_en = el.attrs["text"].split(" / ")
    parsha_node = SchemaNode()
    parsha_node.add_primary_titles(parsha_en, parsha_he)
    for child in [child for child in el.contents if child != "\n"]:
        he, en = child.attrs["text"].split(" / ")
        ref = en.replace("Section ", "")
        child_node = ArrayMapNode()
        child_node.add_primary_titles(en, he)
        child_node.depth = 0
        child_node.refs = []
        child_node.wholeRef = "Sichot Avodat Levi {}".format(ref)
        parsha_node.append(child_node)
    parsha_node.validate()
    nodes.append(parsha_node.serialize())
index["alt_structs"] = {"Parasha": {"nodes": nodes}}
post_index(index, server="http://draft.sefaria.org")
コード例 #9
0
ファイル: upload.py プロジェクト: JonMosenkis/Sefaria-Data
def shulchan_arukh_index(server='http://localhost:8000', *args, **kwargs):
    original_index = get_index_api("Shulchan Arukh, Choshen Mishpat", server=server)
    alt_struct = get_alt_struct("Shulchan Arukh, Choshen Mishpat")
    original_index['alt_structs'] = {'Topic': alt_struct}
    return original_index
コード例 #10
0
ファイル: alt_toc.py プロジェクト: Sefaria/Sefaria-Data
    nodes = []
    with open("Shelah_Alt_Struct.csv") as f:
        f.readline()
        reader = csv.reader(f)
        for row in reader:
            ref, alt_toc = row
            node = ArrayMapNode()
            he = AddressTalmud.toStr("he", AddressTalmud(0).toNumber("en", alt_toc))
            node.add_primary_titles(alt_toc, he)
            node.wholeRef = ref
            node.refs = []
            node.depth = 0
            node.validate()
            nodes.append(node.serialize())

    index = get_index_api("Shenei Luchot HaBerit", server="http://www.sefaria.org")
    index['alt_structs'] = {"Pages": {"nodes": nodes}}
    post_index(index, server="http://proto.sefaria.org")




    # from sefaria.helper.schema import migrate_to_complex_structure
    #
    # #now convert schema and links and sheets and history
    # mapping = {
    #     "Aruch HaShulchan 1": "Aruch HaShulchan, Orach Chaim",
    #     "Aruch HaShulchan 2": "Aruch HaShulchan, Yoreh De'ah",
    #     "Aruch HaShulchan 3": "Aruch HaShulchan, Even HaEzer",
    #     "Aruch HaShulchan 4": "Aruch HaShulchan, Choshen Mishpat"
    # }
コード例 #11
0
import django
django.setup()
from sefaria.model import *
from sources.functions import get_index_api, post_index, post_category

if __name__ == "__main__":
    SERVER = "https://www.sefaria.org"
    # c = Category()
    # c.path = ["Tanakh", "Commentary", "Joseph ibn Yahya"]
    # c.add_shared_term("Joseph ibn Yahya")
    # c.save()
    # post_category(c.contents(), server=SERVER)
    #
    # c = Category()
    # c.path = ["Tanakh", "Commentary", "Joseph ibn Yahya", "Writings"]
    # c.add_shared_term("Writings")
    # c.save()
    # post_category(c.contents(), server=SERVER)

    index = get_index_api("Joseph ibn Yahya on Esther", server=SERVER)
    index["categories"] = [
        "Tanakh", "Commentary", "Joseph ibn Yahya", "Writings"
    ]
    post_index(index, server=SERVER)
コード例 #12
0
    with open("Shelah_Alt_Struct.csv") as f:
        f.readline()
        reader = csv.reader(f)
        for row in reader:
            ref, alt_toc = row
            node = ArrayMapNode()
            he = AddressTalmud.toStr("he",
                                     AddressTalmud(0).toNumber("en", alt_toc))
            node.add_primary_titles(alt_toc, he)
            node.wholeRef = ref
            node.refs = []
            node.depth = 0
            node.validate()
            nodes.append(node.serialize())

    index = get_index_api("Shenei Luchot HaBerit",
                          server="http://www.sefaria.org")
    index['alt_structs'] = {"Pages": {"nodes": nodes}}
    post_index(index, server="http://proto.sefaria.org")

    # from sefaria.helper.schema import migrate_to_complex_structure
    #
    # #now convert schema and links and sheets and history
    # mapping = {
    #     "Aruch HaShulchan 1": "Aruch HaShulchan, Orach Chaim",
    #     "Aruch HaShulchan 2": "Aruch HaShulchan, Yoreh De'ah",
    #     "Aruch HaShulchan 3": "Aruch HaShulchan, Even HaEzer",
    #     "Aruch HaShulchan 4": "Aruch HaShulchan, Choshen Mishpat"
    # }
    # root = SchemaNode()
    # root.add_primary_titles("Aruch HaShulchan", u"ערוך השולחן")
    # nodes = [("Orach Chaim", u"אורח חיים"), ("Yoreh De'ah", u"יורה דעה"), ("Even HaEzer", u"אבן העזר"), ("Choshen Mishpat", u"חושן משפט")]