本文整理汇总了Python中term.Term.definition方法的典型用法代码示例。如果您正苦于以下问题:Python Term.definition方法的具体用法?Python Term.definition怎么用?Python Term.definition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类term.Term
的用法示例。
在下文中一共展示了Term.definition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_term
# 需要导入模块: from term import Term [as 别名]
# 或者: from term.Term import definition [as 别名]
def build_term(dict):
"""
Builds a Term object from the term metadata dictionary provided.
"""
# Add our metadata to our term piece-by-piece
term = Term()
try:
term.id = dict['id'][0]
term.name = dict['name'][0]
except KeyError as k:
raise TermMissingRequiredFieldException("Missing required field %s" % k)
termDef = dict.get('def', [""])
term.definition = termDef[0]
obsoleteBool = dict.get('is_obsolete', [False])
term.obsolete = obsoleteBool[0]
term.synonyms.extend( format_synonym_list(dict.get('synonym', [])) )
term.relationships.extend( dict.get('relationship', []) )
term.xrefs.extend( dict.get('xref', []) )
term.alternateIds.extend( dict.get('alt_id', []) )
term.subsets.extend( dict.get('subset', []) )
return term