本文整理汇总了Python中shogun.Features.StringWordFeatures.set_feature_vector方法的典型用法代码示例。如果您正苦于以下问题:Python StringWordFeatures.set_feature_vector方法的具体用法?Python StringWordFeatures.set_feature_vector怎么用?Python StringWordFeatures.set_feature_vector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shogun.Features.StringWordFeatures
的用法示例。
在下文中一共展示了StringWordFeatures.set_feature_vector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: features_string_word_modular
# 需要导入模块: from shogun.Features import StringWordFeatures [as 别名]
# 或者: from shogun.Features.StringWordFeatures import set_feature_vector [as 别名]
def features_string_word_modular(strings, start, order, gap, rev):
from shogun.Features import StringCharFeatures, StringWordFeatures, RAWBYTE
from numpy import array, uint16
# create string features
cf = StringCharFeatures(strings, RAWBYTE)
wf = StringWordFeatures(RAWBYTE)
wf.obtain_from_char(cf, start, order, gap, rev)
# and output several stats
# print "max string length", wf.get_max_vector_length()
# print "number of strings", wf.get_num_vectors()
# print "length of first string", wf.get_vector_length(0)
# print "string[2]", wf.get_feature_vector(2)
# print "strings", wf.get_features()
# replace string 0
wf.set_feature_vector(array([1, 2, 3, 4, 5], dtype=uint16), 0)
# print "strings", wf.get_features()
return wf.get_features(), wf