本文整理汇总了Python中activity.Activity.get_tier方法的典型用法代码示例。如果您正苦于以下问题:Python Activity.get_tier方法的具体用法?Python Activity.get_tier怎么用?Python Activity.get_tier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类activity.Activity
的用法示例。
在下文中一共展示了Activity.get_tier方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: append_extra
# 需要导入模块: from activity import Activity [as 别名]
# 或者: from activity.Activity import get_tier [as 别名]
def append_extra(self, trs):
"""
Append extra tiers in trs: Activity and PhnTokAlign.
"""
tokenalign = trs.Find("TokensAlign")
if tokenalign is None:
self.print_message("No time-aligned tokens found. No extra tier can be generated.", indent=2, status=WARNING_ID)
return trs
# PhnTokAlign tier
if self._options['phntok'] is True:
try:
phonalign = trs.Find("PhonAlign")
tier = self.phntokalign_tier(phonalign,tokenalign)
trs.Append(tier)
trs.GetHierarchy().addLink("TimeAssociation", tokenalign, tier)
except Exception as e:
self.print_message("PhnTokAlign generation: %s"%str(e), indent=2, status=WARNING_ID)
# Activity tier
if self._options['activity'] is True or self._options['activityduration']:
try:
activity = Activity( trs )
tier = activity.get_tier()
if self._options['activity'] is True:
trs.Append(tier)
trs.GetHierarchy().addLink("TimeAlignment", tokenalign, tier)
if self._options['activityduration'] is True:
dtier = tier.Copy()
dtier.SetName( "ActivityDuration" )
trs.Append(dtier)
for a in dtier:
d = a.GetLocation().GetDuration().GetValue()
a.GetLabel().SetValue( '%.3f' % d )
except Exception as e:
self.print_message("Activities generation: %s"%str(e), indent=2, status=WARNING_ID)
return trs