Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
RookieCuzz
2025-10-08 10:26:45 +08:00
6 changed files with 484 additions and 0 deletions

View File

@@ -83,3 +83,21 @@ git clone https://github.com/Konsheng/Sensitive-lexicon.git
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=konsheng/Sensitive-lexicon&type=Date" />
</picture>
</a>
## 运行敏感词检测服务Fiber + fuzzy-patricia
```bash
# Windows PowerShell 示例
$env:PORT="8080"; $env:LEXICON_DIR="Vocabulary"; $env:FUZZY_MAX_DISTANCE="1"
# 构建并运行
go mod tidy
go build -o bin\server.exe ./cmd/server
./bin/server.exe
```
- POST `/detect`
- 请求体: `{ "text": "待检测文本", "enable_fuzzy": true }`
- 响应: `{ "hits": [{"word":"...","type":"substring|fuzzy","distance":0}] }`
- POST `/reload` 重新加载 `Vocabulary` 目录
- GET `/health` 存活探针