本文整理匯總了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