跳转到主要内容

Andrew Tridgell的spamsum算法的Python封装

项目描述

https://img.shields.io/pypi/pyversions/pyspamsum.svg https://img.shields.io/pypi/v/pyspamsum.svg https://img.shields.io/pypi/status/pyspamsum.svg https://img.shields.io/pypi/l/pyspamsum.svg https://travis-ci.org/pybee/pyspamsum.svg?branch=master

spamsum 是一个模糊哈希,专门设计用于对电子邮件消息进行哈希处理以检测其是否为垃圾邮件。spamsum 工具包括生成 spamsum 哈希以及将新消息与现有的哈希集进行比较以查找匹配的功能。

py spamsum 是 spamsum 核心API的Python封装。

原始的 spamsum 代码是根据 Perl Artistic 许可证条款授权的。它已经略有修改

原始代码版权所有 Andrew Tridgell <tridge@samba.org> 2002。它是 Andrew 的 junkcode 的一部分,并可在以下位置获取

http://www.samba.org/junkcode/#spamsum

本项目中的 spamsum 代码来源于 Linux.conf.au 2004 公布的更新版本

http://linux.anu.edu.au/linux.conf.au/2004/papers/junkcode/spamsum

有关 spamsum 的详细信息,请参阅 spamsum README

http://samba.org/ftp/unpacked/junkcode/spamsum/README

安装

在提示符下,运行

$ python setup.py install

用法

安装后,这里有一些用法示例

# Import spamsum and set up some strings
>>> import spamsum
>>> s1 = "I am the very model of a modern Major-General, I've information animal and vegetable and mineral"
>>> s2 = "I am the very model of a modern Brigadier, I've information animal and vegetable and something else"
>>> s3 = "Huh? Gilbert and Who?"

# Evaluate the edit distance between two strings
>>> spamsum.edit_distance(s1, s2)
27

# Evaluate the spamsum of some strings
>>> sum1 = spamsum.spamsum(s1)
>>> sum2 = spamsum.spamsum(s2)
>>> sum3 = spamsum.spamsum(s2)
>>> print sum1
3:kEvyc/sFIKwYclQY4MKLFE4Igu0uLzIKygn:kE6Ai3KQ/MKOgDKZn

# Compare two spamsums. 0 = no match, 100 = perfect match.
>>> spamsum.match(sum1, sum1)
100
>>> spamsum.match(sum1, sum2)
72
>>> spamsum.match(sum1, sum3)
0

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关 安装包 的更多信息。

源代码分发

pyspamsum-1.0.5.tar.gz (14.2 kB 查看哈希值)

上传时间 源代码

构建分发

pyspamsum-1.0.5-cp39-cp39-macosx_10_15_x86_64.whl (11.2 kB 查看哈希值)

上传时间 CPython 3.9 macOS 10.15+ x86-64

pyspamsum-1.0.5-cp38-cp38-macosx_10_15_x86_64.whl (11.2 kB 查看哈希值)

上传时间 CPython 3.8 macOS 10.15+ x86-64

pyspamsum-1.0.5-cp37-cp37m-macosx_10_15_x86_64.whl (11.2 kB 查看哈希值)

上传时间 CPython 3.7m macOS 10.15+ x86-64

pyspamsum-1.0.5-cp36-cp36m-macosx_10_15_x86_64.whl (11.2 kB 查看哈希值)

上传时间 CPython 3.6m macOS 10.15+ x86-64

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面