<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="/wp-content/plugins/rss-beauty/pink.xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>akismet Archives - obaby 𝐢‍𝐧⃝ void</title>
	<atom:link href="https://zhongxiaojie.cn/tag/akismet/feed/" rel="self" type="application/rss+xml" />
	<link>https://zhongxiaojie.cn/tag/akismet/</link>
	<description>程序媛 / 独立开发者 / 智商不稳定的女神经</description>
	<lastBuildDate>Mon, 06 Apr 2026 12:27:22 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://zhongxiaojie.cn/wp-content/uploads/2026/01/uugai.com-166111691272754-100x100.png</url>
	<title>akismet Archives - obaby 𝐢‍𝐧⃝ void</title>
	<link>https://zhongxiaojie.cn/tag/akismet/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Baby Anti-Spam 自建反垃圾评论系统</title>
		<link>https://zhongxiaojie.cn/2026/04/798/</link>
					<comments>https://zhongxiaojie.cn/2026/04/798/#comments</comments>
		
		<dc:creator><![CDATA[obaby]]></dc:creator>
		<pubDate>Mon, 06 Apr 2026 10:05:11 +0000</pubDate>
				<category><![CDATA[程序媛]]></category>
		<category><![CDATA[akismet]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[垃圾评论]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[机器学习]]></category>
		<guid isPermaLink="false">https://zhongxiaojie.cn/?p=798</guid>

					<description><![CDATA[很久之前，就经常收到akismet的授权提醒，对应一个错误码10010。 刚开始还以为是多域名访问导致的授权校 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="https://zhongxiaojie.cn/wp-content/uploads/2026/04/330A0347.jpg" data-lbwps-width="4000" data-lbwps-height="6211" data-lbwps-srcsmall="https://zhongxiaojie.cn/wp-content/uploads/2026/04/330A0347.jpg" data-lightbox="gal[798]" data-lbwps-exif="&lt;span class=&quot;pswp__caption__exif_camera&quot;&gt;Canon EOS R6m2&lt;/span&gt; &lt;span class=&quot;pswp__caption__exif_focal&quot;&gt;50mm&lt;/span&gt; &lt;span class=&quot;pswp__caption__exif_fstop&quot;&gt;𝑓/4&lt;/span&gt; &lt;span class=&quot;pswp__caption__exif_shutter&quot;&gt;1/160s&lt;/span&gt; &lt;span class=&quot;pswp__caption__exif_iso&quot;&gt;ISO500&lt;/span&gt; &lt;span class=&quot;pswp__caption__exif_datetime&quot;&gt;2026年3月5日&lt;/span&gt; "><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-807" src="https://zhongxiaojie.cn/wp-content/uploads/2026/04/330A0347-scaled.jpg" alt="" width="1649" height="2560" srcset="https://zhongxiaojie.cn/wp-content/uploads/2026/04/330A0347-scaled.jpg?v=1775469075 1649w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/330A0347-193x300.jpg?v=1775469075 193w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/330A0347-659x1024.jpg?v=1775469075 659w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/330A0347-97x150.jpg?v=1775469075 97w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/330A0347-768x1193.jpg?v=1775469075 768w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/330A0347-989x1536.jpg?v=1775469075 989w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/330A0347-1319x2048.jpg?v=1775469075 1319w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/330A0347-665x1033.jpg?v=1775469075 665w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/330A0347-167x260.jpg?v=1775469075 167w" sizes="(max-width: 1649px) 100vw, 1649px" /></a></p>
<p>很久之前，就经常收到akismet的授权提醒，对应一个错误码10010。</p>
<p><span id="more-798"></span></p>
<p><a href="https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-13-58.png" data-lbwps-width="2540" data-lbwps-height="303" data-lbwps-srcsmall="https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-13-58-665x79.png" data-lightbox="gal[798]"><img decoding="async" class="alignnone size-full wp-image-799" src="https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-13-58.png" alt="" width="2540" height="303" srcset="https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-13-58.png?v=1775467728 2540w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-13-58-300x36.png?v=1775467728 300w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-13-58-1024x122.png?v=1775467728 1024w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-13-58-150x18.png?v=1775467728 150w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-13-58-768x92.png?v=1775467728 768w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-13-58-1536x183.png?v=1775467728 1536w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-13-58-2048x244.png?v=1775467728 2048w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-13-58-665x79.png?v=1775467728 665w" sizes="(max-width: 2540px) 100vw, 2540px" /></a></p>
<p><a href="https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-16-0.png" data-lbwps-width="1121" data-lbwps-height="1398" data-lbwps-srcsmall="https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-16-0.png" data-lightbox="gal[798]"><img decoding="async" class="alignnone size-full wp-image-801" src="https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-16-0.png" alt="" width="1121" height="1398" srcset="https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-16-0.png?v=1775467732 1121w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-16-0-241x300.png?v=1775467732 241w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-16-0-821x1024.png?v=1775467732 821w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-16-0-120x150.png?v=1775467732 120w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-16-0-768x958.png?v=1775467732 768w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-16-0-665x829.png?v=1775467732 665w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_14-16-0-208x260.png?v=1775467732 208w" sizes="(max-width: 1121px) 100vw, 1121px" /></a></p>
<p>刚开始还以为是多域名访问导致的授权校验出问题了。后来换了n个key，同时添加了插件hook掉所有的垃圾评论检测逻辑，让全部走统一的域名，结果前几天又收到这个提醒了。</p>
<p><a href="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-202533.png" data-lbwps-width="952" data-lbwps-height="1556" data-lbwps-srcsmall="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-202533.png" data-lightbox="gal[798]"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-820" src="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-202533.png" alt="" width="952" height="1556" srcset="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-202533.png?v=1775478429 952w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-202533-184x300.png?v=1775478429 184w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-202533-627x1024.png?v=1775478429 627w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-202533-92x150.png?v=1775478429 92w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-202533-768x1255.png?v=1775478429 768w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-202533-940x1536.png?v=1775478429 940w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-202533-665x1087.png?v=1775478429 665w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-202533-159x260.png?v=1775478429 159w" sizes="auto, (max-width: 952px) 100vw, 952px" /></a></p>
<p>插件代码：</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
/**
 * Plugin Name: Akismet 单一主域名（多域名站点）
 * Description: 当站点配置了多个域名时，强制发往 Akismet 的请求只使用一个主域名，避免被计为多站点触发 10010。
 * Version: 1.0
 * Author: obaby
 *
 * 使用：在下方设置 AKISMET_CANONICAL_HOME 为主域名（或留空则用 WordPress「设置」里的站点地址）。
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * 主域名（规范 URL，不要末尾斜杠）。留空则使用 get_option( 'home' )。
 * 例如: https://www.example.com
 */
if ( ! defined( 'AKISMET_CANONICAL_HOME' ) ) {
    define( 'AKISMET_CANONICAL_HOME', 'https://zhongxiaojie.cn' );
}

/**
 * 获取发往 Akismet 时使用的唯一主域名 URL。
 */
function akismet_single_domain_get_canonical_home() {
    $home = AKISMET_CANONICAL_HOME;
    if ( $home === '' || $home === null ) {
        $home = get_option( 'home' );
    }
    return untrailingslashit( $home );
}

/**
 * 将任意 URL 替换为使用主域名的版本（只改 host，保留 path/query）。
 */
function akismet_single_domain_normalize_url( $url, $canonical_home ) {
    if ( empty( $url ) || ! is_string( $url ) ) {
        return $url;
    }
    $parsed = wp_parse_url( $url );
    $canon  = wp_parse_url( $canonical_home );
    if ( empty( $canon['scheme'] ) || empty( $canon['host'] ) ) {
        return $url;
    }
    $scheme = isset( $parsed['scheme'] ) ? $parsed['scheme'] : $canon['scheme'];
    $host   = $canon['host'];
    $path   = isset( $parsed['path'] ) ? $parsed['path'] : '/';
    $query  = isset( $parsed['query'] ) ? '?' . $parsed['query'] : '';
    $frag   = isset( $parsed['fragment'] ) ? '#' . $parsed['fragment'] : '';
    return $scheme . '://' . $host . $path . $query . $frag;
}

/**
 * 统一 verify-key / get-subscription / get-stats 的 blog 为主域名。
 */
add_filter( 'akismet_request_args', function ( $request_args, $path ) {
    $paths = array( 'verify-key', 'get-subscription', 'get-stats' );
    if ( ! in_array( $path, $paths, true ) ) {
        return $request_args;
    }
    $canon = akismet_single_domain_get_canonical_home();
    if ( ! empty( $request_args['blog'] ) ) {
        $request_args['blog'] = $canon;
    }
    return $request_args;
}, 10, 2 );

/**
 * 统一 comment-check（以及 recheck）的 blog、permalink，并把请求里的 HTTP_HOST 等改为主域名。
 */
add_filter( 'akismet_request_args', function ( $request_args, $path ) {
    if ( $path !== 'comment-check' ) {
        return $request_args;
    }
    $canon = akismet_single_domain_get_canonical_home();
    $parsed = wp_parse_url( $canon );
    if ( empty( $parsed['host'] ) ) {
        return $request_args;
    }
    $canon_host = $parsed['host'];

    $request_args['blog'] = $canon;
    if ( ! empty( $request_args['permalink'] ) ) {
        $request_args['permalink'] = akismet_single_domain_normalize_url( $request_args['permalink'], $canon );
    }

    // 让服务端看到的“当前请求”也统一为主域名，减少被计为多站点
    if ( isset( $request_args['HTTP_HOST'] ) ) {
        $request_args['HTTP_HOST'] = $canon_host;
    }
    if ( isset( $request_args['REQUEST_URI'] ) ) {
        $uri = $request_args['REQUEST_URI'];
        $request_args['REQUEST_URI'] = ( is_string( $uri ) &amp;&amp; ( $p = wp_parse_url( $uri, PHP_URL_PATH ) ) !== null ) ? $p : '/';
    }
    if ( isset( $request_args['DOCUMENT_URI'] ) ) {
        $uri = $request_args['DOCUMENT_URI'];
        $request_args['DOCUMENT_URI'] = ( is_string( $uri ) &amp;&amp; ( $p = wp_parse_url( $uri, PHP_URL_PATH ) ) !== null ) ? $p : '/';
    }
    return $request_args;
}, 10, 2 );

/**
 * 统一 submit-spam / submit-ham 的 blog、permalink。
 */
add_filter( 'akismet_request_args', function ( $request_args, $path ) {
    if ( ! in_array( $path, array( 'submit-spam', 'submit-ham' ), true ) ) {
        return $request_args;
    }
    $canon = akismet_single_domain_get_canonical_home();
    $request_args['blog'] = $canon;
    if ( ! empty( $request_args['permalink'] ) ) {
        $request_args['permalink'] = akismet_single_domain_normalize_url( $request_args['permalink'], $canon );
    }
    return $request_args;
}, 10, 2 );
</pre>
<p>这次授权的密钥撑得时间稍微长了点，但是最终还是收到了这个提醒，意思是需要订购商业版授权。我这个人站点为了发垃圾评论订购一个商业版授权，确实有些难以接受。</p>
<p>于是，我决定自建反垃圾评论系统，基于scikit-learn实现了现在的这套垃圾评论检测系统，训练数据一部分来源于github的开源数据，另外一个就是我自己博客的评论数据。为了保证样本正例和负例数量差别不至于过大，经过各种方式进行了多轮数据清洗。</p>
<p>如果想要评论识别更加准确，可以提供自己的博客评论数据，如果能提供垃圾评论更好。现在欠缺的主要是垃圾评论数据，正常的评论数据我已经提供几千条数据。</p>
<p>效果测试：</p>
<p><a href="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175352.png" data-lbwps-width="3070" data-lbwps-height="1673" data-lbwps-srcsmall="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175352-665x362.png" data-lightbox="gal[798]"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-808" src="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175352-scaled.png" alt="" width="2560" height="1395" srcset="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175352-scaled.png?v=1775469300 2560w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175352-300x163.png?v=1775469300 300w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175352-1024x558.png?v=1775469300 1024w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175352-150x82.png?v=1775469300 150w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175352-768x419.png?v=1775469300 768w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175352-1536x837.png?v=1775469300 1536w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175352-2048x1116.png?v=1775469300 2048w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175352-665x362.png?v=1775469300 665w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175352-477x260.png?v=1775469300 477w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></a></p>
<p><a href="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175539.png" data-lbwps-width="2894" data-lbwps-height="1666" data-lbwps-srcsmall="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175539-665x383.png" data-lightbox="gal[798]"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-809" src="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175539-scaled.png" alt="" width="2560" height="1474" srcset="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175539-scaled.png?v=1775469393 2560w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175539-300x173.png?v=1775469393 300w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175539-1024x589.png?v=1775469393 1024w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175539-150x86.png?v=1775469393 150w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175539-768x442.png?v=1775469393 768w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175539-1536x884.png?v=1775469393 1536w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175539-2048x1179.png?v=1775469393 2048w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175539-665x383.png?v=1775469393 665w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175539-452x260.png?v=1775469393 452w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></a></p>
<p>测试地址：<a href="https://anti-spam.zhongxiaojie.cn/test/spam" target="_blank" rel="noopener">https://anti-spam.zhongxiaojie.cn/test/spam</a></p>
<p>简介：</p>
<p>面向 <strong>中英混合</strong> 评论的 WordPress 垃圾识别方案：PHP 插件在评论入库前调用 <strong>本机 Python 服务</strong>，由小型多语种向量模型 + 分类器（或演示用规则）给出垃圾概率。</p>
<p>适合评论量不大、单机部署（例如 <strong>4 核 / 8GB RAM</strong> 的 Ubuntu），服务与 WordPress 同机时使用 <code>127.0.0.1</code> 即可。</p>
<p>目录结构：</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">baby_anti_spam/
├── README.md
├── screenshots/             # 文档：服务启动与 curl 自测示意
│   ├── service.png
│   └── test.png
├── service/                 # Python FastAPI 侧车服务
│   ├── .env.example
│   ├── requirements.txt
│   ├── requirements-ml.txt
│   ├── run.py
│   ├── app/
│   │   └── stats_backends/   # 统计存储：sqlite / mysql
│   └── scripts/
│       ├── init_stats_mysql.sql
│       └── init_stats_mysql.py
│       ├── train_sklearn.py
│       ├── download_embedding_model.py
│       └── download_embedding_model.sh
└── wordpress/baby-anti-spam/
    └── baby-anti-spam.php # WordPress 插件</pre>
<p>关键配置：</p>
<table>
<thead>
<tr>
<th>变量</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>SPAM_HOST</code></td>
<td>监听地址，同机建议 <code>127.0.0.1</code></td>
</tr>
<tr>
<td><code>SPAM_PORT</code></td>
<td>端口，默认 <code>8765</code></td>
</tr>
<tr>
<td><code>SPAM_API_SECRET</code></td>
<td><strong>单密钥模式（兼容旧版）</strong>：未配置 <code>SPAM_API_KEYS</code> 且未配置 <code>SPAM_API_KEYS_FILE</code> 时，仅此密钥有效，等价于 name=<code>default</code>、不限流（<code>max_rpm=0</code>）。与 WP 插件里填写的密钥一致</td>
</tr>
<tr>
<td><code>SPAM_API_KEYS</code></td>
<td><strong>多密钥</strong>：JSON 数组。每项为 <code>name</code>（唯一，用于统计与限流分组）、<code>key</code> 或 <code>secret</code>（与请求头一致）、<code>max_rpm</code> 或 <code>rpm</code>（每分钟最大请求数，<code>0</code> 表示不限制）。与 <code>SPAM_API_KEYS_FILE</code> 合并时：<strong>先读文件条目，再追加本变量</strong></td>
</tr>
<tr>
<td><code>SPAM_API_KEYS_FILE</code></td>
<td>可选，指向 JSON 文件，根节点为与上表相同结构的<strong>数组</strong>。文件必须存在，否则进程启动失败</td>
</tr>
<tr>
<td><code>SPAM_MODEL_PATH</code></td>
<td>训练得到的 <code>*.joblib</code> 路径；留空则取决于 <code>SPAM_FALLBACK_RULES</code></td>
</tr>
<tr>
<td><code>SPAM_FALLBACK_RULES</code></td>
<td>无模型文件时是否启用内置极简规则（演示用）；生产训练后应设为 <code>false</code> 并配置 <code>SPAM_MODEL_PATH</code></td>
</tr>
<tr>
<td><code>SPAM_LABEL_THRESHOLD</code></td>
<td>可选，默认 <code>0.8</code>。<code>spam_score</code> ≥ 此值时 JSON 中 <code>label</code> 为 <code>spam</code>，否则为 <code>normal</code></td>
</tr>
<tr>
<td><code>SPAM_DFA_ENABLED</code></td>
<td>默认 <code>true</code>。为 <code>true</code> 时使用 <code>dfa-python-filter/keywords</code> 做敏感词检测；命中则直接 <code>spam_score=1</code>、<code>detail=dfa_sensitive</code>（早于 sklearn）</td>
</tr>
<tr>
<td><code>SPAM_DFA_KEYWORDS_PATH</code></td>
<td>可选，自定义敏感词文件路径；留空则用 <code>service/dfa-python-filter/keywords</code></td>
</tr>
<tr>
<td><code>SPAM_NON_CHINESE_FLOOR_ENABLED</code></td>
<td>默认 <code>true</code>。为 <code>true</code> 时若合并后的 author/email/url/text 中<strong>无任何 CJK 表意字符</strong>（主要针对中文训练语料），则将 <code>spam_score</code> <strong>至少</strong>抬到 <code>SPAM_NON_CHINESE_SPAM_FLOOR</code></td>
</tr>
<tr>
<td><code>SPAM_NON_CHINESE_SPAM_FLOOR</code></td>
<td>默认 <code>0.9</code>。与上项配合，在「无中文」评论上与 sklearn / 规则分取 <code>max</code></td>
</tr>
<tr>
<td><code>SPAM_STATS_ENABLED</code></td>
<td>默认 <code>true</code>。为 <code>true</code> 时记录每次<strong>成功</strong>返回的 <code>/v1/classify</code> 请求与响应（失败 / 401 不落库），并允许 <code>/v1/mark-spam</code> 写入 <code>spam_marks</code> 表</td>
</tr>
<tr>
<td><code>SPAM_STATS_BACKEND</code></td>
<td><code>sqlite</code>（默认）或 <code>mysql</code>。选 <code>mysql</code> 时需安装 <code>pymysql</code>（已在 <code>requirements.txt</code>）并配置下方 MySQL 变量</td>
</tr>
<tr>
<td><code>SPAM_STATS_DB_PATH</code></td>
<td>仅 <code>sqlite</code>：数据库文件路径；留空则为 <code>service/data/stats.sqlite</code>（已加入 <code>.gitignore</code>）</td>
</tr>
<tr>
<td><code>SPAM_STATS_MYSQL_HOST</code> / <code>SPAM_STATS_MYSQL_PORT</code></td>
<td>仅 <code>mysql</code>：默认 <code>127.0.0.1</code> / <code>3306</code></td>
</tr>
<tr>
<td><code>SPAM_STATS_MYSQL_USER</code> / <code>SPAM_STATS_MYSQL_PASSWORD</code></td>
<td>仅 <code>mysql</code>：连接账号（<code>user</code> 必填）</td>
</tr>
<tr>
<td><code>SPAM_STATS_MYSQL_DATABASE</code></td>
<td>仅 <code>mysql</code>：库名（必填），默认示例 <code>baby_spam_stats</code></td>
</tr>
<tr>
<td><code>SPAM_STATS_MYSQL_CHARSET</code></td>
<td>仅 <code>mysql</code>：默认 <code>utf8mb4</code></td>
</tr>
</tbody>
</table>
<p>系统服务启动截图：</p>
<p><a href="https://zhongxiaojie.cn/wp-content/uploads/2026/04/service.png" data-lbwps-width="2664" data-lbwps-height="1395" data-lbwps-srcsmall="https://zhongxiaojie.cn/wp-content/uploads/2026/04/service-665x348.png" data-lightbox="gal[798]"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-803" src="https://zhongxiaojie.cn/wp-content/uploads/2026/04/service-scaled.png" alt="" width="2560" height="1341" srcset="https://zhongxiaojie.cn/wp-content/uploads/2026/04/service-scaled.png?v=1775467740 2560w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/service-300x157.png?v=1775467740 300w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/service-1024x536.png?v=1775467740 1024w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/service-150x79.png?v=1775467740 150w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/service-768x402.png?v=1775467740 768w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/service-1536x804.png?v=1775467740 1536w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/service-2048x1072.png?v=1775467740 2048w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/service-665x348.png?v=1775467740 665w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/service-497x260.png?v=1775467740 497w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></a></p>
<p>wp插件配置：</p>
<p><a href="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175939.png" data-lbwps-width="1029" data-lbwps-height="1724" data-lbwps-srcsmall="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175939.png" data-lightbox="gal[798]"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-810" src="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175939.png" alt="" width="1029" height="1724" srcset="https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175939.png?v=1775469593 1029w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175939-179x300.png?v=1775469593 179w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175939-611x1024.png?v=1775469593 611w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175939-90x150.png?v=1775469593 90w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175939-768x1287.png?v=1775469593 768w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175939-917x1536.png?v=1775469593 917w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175939-665x1114.png?v=1775469593 665w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/Screenshot-2026-04-06-175939-155x260.png?v=1775469593 155w" sizes="auto, (max-width: 1029px) 100vw, 1029px" /></a></p>
<p>项目地址：<a href="https://anti-spam.zhongxiaojie.cn" target="_blank" rel="noopener">https://anti-spam.zhongxiaojie.cn</a></p>
<p>代码地址：<a href="https://cnb.cool/oba.by/baby-wp-anti-spam" target="_blank" rel="noopener">https://cnb.cool/oba.by/baby-wp-anti-spam</a></p>
<p>说明：如果自己不想训练数据，下载发布版的spam_pipeline.joblib 放入指定目录下配置服务启动即可，<a class="hover:underline hover:text-link truncate" href="https://cnb.cool/oba.by/baby-wp-anti-spam/-/releases/download/v2.0/baby-anti-spam.zip" download="">baby-anti-spam.zip</a> 为wp插件。</p>
<p>训练耗时大约11分钟：</p>
<p><a href="https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_18-3-45.png" data-lbwps-width="2088" data-lbwps-height="112" data-lbwps-srcsmall="https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_18-3-45-665x36.png" data-lightbox="gal[798]"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-811" src="https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_18-3-45.png" alt="" width="2088" height="112" srcset="https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_18-3-45.png?v=1775469858 2088w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_18-3-45-300x16.png?v=1775469858 300w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_18-3-45-1024x55.png?v=1775469858 1024w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_18-3-45-150x8.png?v=1775469858 150w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_18-3-45-768x41.png?v=1775469858 768w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_18-3-45-1536x82.png?v=1775469858 1536w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_18-3-45-2048x110.png?v=1775469858 2048w, https://zhongxiaojie.cn/wp-content/uploads/2026/04/BaiduShurufa_2026-4-6_18-3-45-665x36.png?v=1775469858 665w" sizes="auto, (max-width: 2088px) 100vw, 2088px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://zhongxiaojie.cn/2026/04/798/feed/</wfw:commentRss>
			<slash:comments>22</slash:comments>
		
		
			</item>
	</channel>
</rss>
