杂音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@Override   使用BuffereImage加载映像时java高ram使用率   java For循环混乱,为什么不是循环?   java Android网格视图字符串对齐问题   java如何将方法与比较类型的附加功能进行比较?   在Java Swing中放置JSepator后的间隙大小   java如何避免并发访问我的网站中的支付链接   java如何从现有的Unix服务器连接到FTP服务器?   Spring中的java用户相关bean定义   带有scribesjava库的wordpress Woocommerce REST API返回消费者密钥参数缺失错误消息   java我可以自动检测特定设备连接的串行端口吗?   Javafx棋盘游戏   java使用JTextPane显示HTML,支持SVG吗?   SpringBoot如何在java中将映射转换为实体对象?   如何使用java代码对xls文件进行密码保护   Java JPA(EclipseLink)如何在持久化实际实体之前接收下一个生成的值?   Javaservlet启动外部进程