杂音3 https://code.google.com/p/smhasher/

featurehash的Python项目详细描述


杂音哈希是一个快速哈希函数:
>>> import featurehash
    >>> featurehash.hash("abc")  #return the hashcode of the string "abc"
            -1277324294
    >>> featurehash.transform_feature("abc")   #return the code and the sign of hashcode;the code is equal to "hashcode mod 8388608(2^23) + 1"
            (2255879, -1.0)
    >>> featurehash.transform_features(["abc","edf","efd","123","efd"]) #pass a sequence to the function,return the sorted unique feature code.
            [124, 2255879, 3759816, 8023169]
    >>> featurehash.transform_features(["abc","edf","efd","123","efd"],8388607) #pass a sequence and upper_bound;upper_bound default 8388608(2^23)
    [124, 2256031, 3760024, 8023393]
    >>> featurehash.transform_features(["abc","edf","efd","123","efd"],8388607,0) #pass a sequence , upper_bound and min value; min value default 1;
    [123, 2256030, 3760023, 8023392]
    >>> featurehash.transform_features(["abc","edf","efd","123","efd"],8388607,1,1) #pass a sequence , upper_bound, min value and seed; seed value default 0;the same application must must the same seed,ensure the consistent value.
    [124, 661165, 3231265, 8317658]

jianghuachinacom@163.com修改

zsp windows,linux python库

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java 安卓 XMLPullParser错误   Java响应网格布局   Java中使用递归的不同方法   java变量可能尚未初始化(边加权图)   java如何将这样的文件插入MySQL数据库   java云端点:不允许实体类型的数组或集合   java(编译器或jvm)是否以不同方式处理类的静态最终成员?如果是,怎么做   java如何从lambda表达式返回新的非抽象映射?   java JDK 7支持的最大Spring版本是什么   我们如何从java类生成DTD   java在我的例子中BindingResult、FieldErrors或GlobalErrors是否可以为null?   java[LibGDX][GWT]读取文件外观时出错。HTML格式的json[序列化异常]   字典Java不可修改密钥集映射   java Admob在firebase sdk之后显示测试广告,但不显示真实广告