本文整理匯總了Python中sefaria.model.schema.JaggedArrayNode.add_primary_titles方法的典型用法代碼示例。如果您正苦於以下問題:Python JaggedArrayNode.add_primary_titles方法的具體用法?Python JaggedArrayNode.add_primary_titles怎麽用?Python JaggedArrayNode.add_primary_titles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sefaria.model.schema.JaggedArrayNode
的用法示例。
在下文中一共展示了JaggedArrayNode.add_primary_titles方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_base_index
# 需要導入模塊: from sefaria.model.schema import JaggedArrayNode [as 別名]
# 或者: from sefaria.model.schema.JaggedArrayNode import add_primary_titles [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_primary_titles [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_primary_titles [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]
}