本文整理汇总了Python中feature.Feature.feat_string方法的典型用法代码示例。如果您正苦于以下问题:Python Feature.feat_string方法的具体用法?Python Feature.feat_string怎么用?Python Feature.feat_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类feature.Feature
的用法示例。
在下文中一共展示了Feature.feat_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mergeFeatures
# 需要导入模块: from feature import Feature [as 别名]
# 或者: from feature.Feature import feat_string [as 别名]
def mergeFeatures(feature_list, name = ""):
dimension = 0
feat_string = ""
for feature in feature_list:
if dimension == 0:# first one
feat_string = feature.feat_string
else:
if feature.feat_string != "":
# change the indices of the current feature.
temp = ""
for item in feature.feat_string.split(" "):
index, value = item.split(":")
temp += " %d:%s" % (int(index)+dimension, value)
feat_string += temp
dimension += feature.dimension
merged_feature = Feature(name, dimension,{})
merged_feature.feat_string = feat_string.strip()
return merged_feature