【问题标题】:Bayesian spam filtering library for Python用于 Python 的贝叶斯垃圾邮件过滤库
【发布时间】:2010-10-08 04:15:25
【问题描述】:

我正在寻找一个执行贝叶斯垃圾邮件过滤的 Python 库。我查看了 SpamBayes 和 OpenBayes,但似乎都没有维护(我可能错了)。

谁能推荐一个实现贝叶斯垃圾邮件过滤的优秀 Python(或 Clojure、Common Lisp,甚至 Ruby)库?

提前致谢。

澄清:我实际上是在寻找贝叶斯垃圾邮件分类器,而不一定是垃圾邮件过滤器。我只想使用一些数据来训练它,然后告诉我某些给定的数据是否是垃圾邮件。如有任何混淆,请见谅。

【问题讨论】:

    标签: python spam-prevention bayesian bayesian-networks


    【解决方案1】:

    RedisBayes 对我来说看起来不错:

    http://pypi.python.org/pypi/redisbayes/0.1.3

    根据我的经验,Redis 是您堆栈的绝佳补充,与 MySQL、PostgreSQL 或任何其他 RDBMS 相比,它可以帮助以极快的速度处理数据。

    import redis, redisbayes
    rb = redisbayes.RedisBayes(redis=redis.Redis())
    
    rb.train('good', 'sunshine drugs love sex lobster sloth')
    rb.train('bad', 'fear death horror government zombie god')
    
    assert rb.classify('sloths are so cute i love them') == 'good'
    assert rb.classify('i fear god and love the government') == 'bad'
    
    print rb.score('i fear god and love the government')
    
    rb.untrain('good', 'sunshine drugs love sex lobster sloth')
    rb.untrain('bad', 'fear death horror government zombie god')
    

    希望能有所帮助。

    【讨论】:

      【解决方案2】:

      试试Reverend。这是一个垃圾邮件过滤模块。

      【讨论】:

      【解决方案3】:

      Python 自然语言工具包 (nltk) 中的一个模块执行朴素贝叶斯分类:nltk.classify.naivebayes

      免责声明:我对贝叶斯分类一无所知,无论是幼稚的还是世俗的。

      【讨论】:

        【解决方案4】:

        SpamBayes 得到维护,并且已经成熟(即无需一直发布新版本即可工作)。它会很容易地做你想做的事。请注意,SpamBayes 只是松散的贝叶斯(它使用卡方组合),但可能您正在使用任何类型的基于统计标记的分类,而不是特定的贝叶斯分类。

        【讨论】:

          【解决方案5】:

          您想要垃圾邮件过滤还是贝叶斯分类?

          对于贝叶斯分类,有许多 Python 模块。我最近刚刚回顾了Orange,这看起来非常令人印象深刻。 R 有许多贝叶斯模块。您可以使用Rpy 连接到 R。

          【讨论】:

            【解决方案6】:

            尝试使用bogofilter,我不确定如何在 Python 中使用它。 Bogofilter 与许多邮件系统集成,这意味着接口相对容易。

            【讨论】:

              猜你喜欢
              • 2010-10-15
              • 2014-05-08
              • 2010-09-26
              • 2011-02-06
              • 2010-09-05
              • 2010-10-20
              • 2010-10-17
              • 2016-03-17
              • 2010-10-03
              相关资源
              最近更新 更多