本文整理汇总了Python中Features.createBeatList方法的典型用法代码示例。如果您正苦于以下问题:Python Features.createBeatList方法的具体用法?Python Features.createBeatList怎么用?Python Features.createBeatList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Features
的用法示例。
在下文中一共展示了Features.createBeatList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createDataLine
# 需要导入模块: import Features [as 别名]
# 或者: from Features import createBeatList [as 别名]
def createDataLine(context, block, leaveout=-1):
dataLine = [str(block[0].shotId) + "_" + str(block[0].beatId), str(block[0].shot)]
featureClassList = Features.getAllFeatureClasses()
context = Features.createBeatList(context, block)
for featureClass in featureClassList:
feature = featureClass(context, block)
dataLine += feature.getNumbers()
# activate to generate a human readable featureLine
#dataLine.append(feature.getText())
if leaveout >= 0:
dataLine.pop(leaveout)
return dataLine
示例2: getFeatureNames
# 需要导入模块: import Features [as 别名]
# 或者: from Features import createBeatList [as 别名]
def getFeatureNames(leave_out_class=None):
"""
Returns an array of feature names corresponding to the featureLine.
"""
names = []
featureClassList = Features.getAllFeatureClasses()
context = createContext()
dummy_beat = Beat("0_1\tfull_shot\tfalse\tintroduce\tperson§Nobody", context)
context = Features.createBeatList(context, [dummy_beat])
Features.initializeContextVars(context)
for featureClass in [x for x in featureClassList if x != leave_out_class]:
feature = featureClass(context, [dummy_beat])
names += feature.getNames()
return names
示例3: getFeatureLine
# 需要导入模块: import Features [as 别名]
# 或者: from Features import createBeatList [as 别名]
def getFeatureLine(context, block, shot, lastShotId, leave_out_class=None):
"""
This function creates a featureLine. This is done by calculating getNumbers() for
all Feature-Classes in Features.py and appending the desired class. A featureLine
consists of several Numbers and a String at the end for the class.
"""
line = []
featureClassList = Features.getAllFeatureClasses()
context = Features.createBeatList(context, block)
# use all features except leave_out_class if given
#for featureClass in [x for x in featureClassList if x != leave_out_class]:
# use only features which contribute significant information
for featureClass in [featureClassList[x] for x in range(len(featureClassList)) if
x in [9, 10, 11, 12, 13, 15, 19, 25, 27, 28, 30, 31, 32, 33, 37,
39, 41, 42]]:
feature = featureClass(context, block)
line += feature.getNumbers()
if shot:
line.append(SHOT_NAMES[block[0].shot])
else:#is there a cut?
line.append(str(lastShotId != block[0].shotId))
return line