当前位置: 首页>>代码示例>>Python>>正文


Python JaggedArrayNode.serialize方法代码示例

本文整理汇总了Python中sefaria.model.schema.JaggedArrayNode.serialize方法的典型用法代码示例。如果您正苦于以下问题:Python JaggedArrayNode.serialize方法的具体用法?Python JaggedArrayNode.serialize怎么用?Python JaggedArrayNode.serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sefaria.model.schema.JaggedArrayNode的用法示例。


在下文中一共展示了JaggedArrayNode.serialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_index

# 需要导入模块: from sefaria.model.schema import JaggedArrayNode [as 别名]
# 或者: from sefaria.model.schema.JaggedArrayNode import serialize [as 别名]
def build_index(titles):

    struct_node = JaggedArrayNode()
    struct_node.add_title('Sefer HaKana', 'en', primary=True)
    struct_node.add_title(u'ספר הקנה', 'he', primary=True)
    struct_node.key = 'Sefer HaKana'
    struct_node.depth = 2
    struct_node.addressTypes = ['Integer', 'Integer']
    struct_node.sectionNames = ['Chapter', 'Comment']
    struct_node.add_title('Sefer HaQana', 'en')
    struct_node.add_title('Sefer HaQanah', 'en')
    struct_node.add_title('Sefer Hakana', 'en')
    struct_node.add_title('Sefer HaKanah', 'en')
    struct_node.validate()

    alt_struct = TitledTreeNode()
    for index, title in enumerate(titles):
        i = index + 1
        node = ArrayMapNode()
        node.add_title('Chapter {}'.format(i), 'en', primary=True)
        node.add_title(title.replace(u'ד"ה ', u''), 'he', primary=True)
        node.depth = 0
        node.wholeRef = 'Sefer HaKana {}'.format(i)
        alt_struct.append(node)

    return {
        'title': 'Sefer HaKana',
        'categories': ['Kabbalah'],
        'schema': struct_node.serialize(),
        'alt_structs': {'Titles': alt_struct.serialize()}
    }
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: post_yitzira

# 需要导入模块: from sefaria.model.schema import JaggedArrayNode [as 别名]
# 或者: from sefaria.model.schema.JaggedArrayNode import serialize [as 别名]
def post_yitzira():
    node = JaggedArrayNode()
    node.add_title('Sefer Yetzirah', 'en', primary=True)
    node.add_title(u'ספר יצירה', 'he', primary=True)
    node.key = 'Sefer Yetzirah'
    node.depth = 2
    node.addressTypes = ['Integer', 'Integer']
    node.sectionNames = ['Chapter', 'Mishnah']
    node.validate()

    y_index = {
        'title': 'Sefer Yetzirah',
        'categories': ['Kabbalah'],
        'language': 'he',
        'schema': node.serialize()
    }

    y_version = {
        'versionTitle': 'Sefer Yetzirah, Warsaw 1884',
        'versionSource': 'http://primo.nli.org.il/primo_library/libweb/action/dlDisplay.do?vid=NLI&docId=NNL_ALEPH001310968',
        'language': 'he',
        'text': parse_yitzira()
    }
    post_index(y_index)
    post_text("Sefer Yetzirah", y_version, index_count='on')
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:27,代码来源:yitzira_parser.py

示例3: get_base_index

# 需要导入模块: from sefaria.model.schema import JaggedArrayNode [as 别名]
# 或者: from sefaria.model.schema.JaggedArrayNode import serialize [as 别名]
    def get_base_index(en_title, he_title):
        node = JaggedArrayNode()
        node.add_primary_titles(en_title, he_title)
        node.add_structure(['Chapter', 'Halakhah'])
        node.validate()

        return {
            'title': en_title,
            'categories': ["Masechtot Ketanot"],
            'schema': node.serialize()
        }
开发者ID:,项目名称:,代码行数:13,代码来源:

示例4: post_simple_commentaries

# 需要导入模块: from sefaria.model.schema import JaggedArrayNode [as 别名]
# 或者: from sefaria.model.schema.JaggedArrayNode import serialize [as 别名]
def post_simple_commentaries():
    ramban_node, rasag_node = JaggedArrayNode(), JaggedArrayNode()
    ramban_text = parse_general('yitzira_ramban.txt')
    rasag_text = parse_general('yitzira_rasag.txt')

    ramban_node.add_title("Ramban on Sefer Yetzirah", 'en', primary=True)
    ramban_node.add_title(u'רמב"ן על ספר יצירה', 'he', primary=True)
    ramban_node.key = "Ramban on Sefer Yetzirah"
    ramban_node.addressTypes = ['Integer', 'Integer', 'Integer']
    ramban_node.sectionNames = ["Chapter", "Mishnah", "Comment"]
    ramban_node.toc_zoom = 2
    ramban_node.depth = 3
    ramban_node.validate()

    rasag_node.add_title("Rasag on Sefer Yetzirah", 'en', primary=True)
    rasag_node.add_title(u'רס"ג על ספר יצירה', 'he', primary=True)
    rasag_node.key = "Rasag on Sefer Yetzirah"
    rasag_node.addressTypes = ['Integer', 'Integer', 'Integer']
    rasag_node.sectionNames = ["Chapter", "Mishnah", "Comment"]
    rasag_node.toc_zoom = 2
    rasag_node.depth = 3
    rasag_node.validate()

    ramban_index = {
        "title": "Ramban on Sefer Yetzirah",
        "categories": ["Commentary2", "Kabbalah", "Ramban"],
        "language": "he",
        "schema": ramban_node.serialize()
    }
    post_index(ramban_index)
    post_text("Ramban on Sefer Yetzirah", {
        'versionTitle': 'Ramban on Sefer Yetzirah, Warsaw 1884',
        'versionSource': 'http://primo.nli.org.il/primo_library/libweb/action/dlDisplay.do?vid=NLI&docId=NNL_ALEPH001310968',
        'language': 'he',
        'text': ramban_text
    })

    rasag_index = {
        "title": "Rasag on Sefer Yetzirah",
        "categories": ["Commentary2", "Kabbalah", "Rasag"],
        "language": "he",
        "schema": rasag_node.serialize()
    }
    post_index(rasag_index)
    post_text("Rasag on Sefer Yetzirah", {
        'versionTitle': 'Rasage on Sefer Yetzirah, Warsaw 1884',
        'versionSource': 'http://primo.nli.org.il/primo_library/libweb/action/dlDisplay.do?vid=NLI&docId=NNL_ALEPH001310968',
        'language': 'he',
        'text': rasag_text
    })
    links = linker(ramban_text, "Ramban on Sefer Yetzirah")
    links.extend(linker(rasag_text, "Rasag on Sefer Yetzirah"))
    post_link(links)
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:55,代码来源:yitzira_parser.py

示例5: build_index

# 需要导入模块: from sefaria.model.schema import JaggedArrayNode [as 别名]
# 或者: from sefaria.model.schema.JaggedArrayNode import serialize [as 别名]
 def build_index(self, base_title, he_base_title):
     """
     Builds the root schema node for the commentary
     :return: serialized index
     """
     node = JaggedArrayNode()
     he_author = self.get_author()
     en_author = commentatorNames[he_author]
     node.add_primary_titles('{} on {}'.format(en_author, base_title), u'{} על {}'.format(he_author, he_base_title))
     node.add_structure(['Chapter', 'Halakhah', 'Comment'])
     node.validate()
     return {
         'title': '{} on {}'.format(en_author, base_title),
         'categories': ['Tanaitic', 'Commentary', en_author, "Masechtot Ketanot"],
         'schema': node.serialize(),
         'collective_title': en_author,
         'dependence': "Commentary",
         'base_text_titles': [base_title]
     }
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:21,代码来源:DCXMLsubs.py


注:本文中的sefaria.model.schema.JaggedArrayNode.serialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。