本文整理汇总了Python中sefaria.model.schema.JaggedArrayNode.add_structure方法的典型用法代码示例。如果您正苦于以下问题:Python JaggedArrayNode.add_structure方法的具体用法?Python JaggedArrayNode.add_structure怎么用?Python JaggedArrayNode.add_structure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sefaria.model.schema.JaggedArrayNode
的用法示例。
在下文中一共展示了JaggedArrayNode.add_structure方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_base_index
# 需要导入模块: from sefaria.model.schema import JaggedArrayNode [as 别名]
# 或者: from sefaria.model.schema.JaggedArrayNode import add_structure [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()
}
示例2: commentary_ja_node
# 需要导入模块: from sefaria.model.schema import JaggedArrayNode [as 别名]
# 或者: from sefaria.model.schema.JaggedArrayNode import add_structure [as 别名]
def commentary_ja_node(en_title, he_title):
"""
Each commentary is a complex text, with a root schema and depth 3 JAnodes for each tractate. The JAnode for each
tractate is essentially identical across commentaries. The root schema is what defines the particular
commentator.
:param en_title: English Title of base text
:param he_title: Hebrew Title of base text
:return: JaggedArrayNode
"""
node = JaggedArrayNode()
node.add_primary_titles(en_title, he_title)
node.add_structure(['Chapter', 'Halakhah', 'Comment'])
node.validate()
return node
示例3: build_index
# 需要导入模块: from sefaria.model.schema import JaggedArrayNode [as 别名]
# 或者: from sefaria.model.schema.JaggedArrayNode import add_structure [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]
}