恢复thesaurus

This commit is contained in:
源文雨 2023-03-25 20:06:49 +08:00
parent aa5c324592
commit f465e78460
5 changed files with 23 additions and 27 deletions

View File

@ -571,14 +571,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 随机书评
</details>
<details>
<summary>打断复读</summary>
`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/breakrepeat"`
- [x] (打断三次以上的复读)
</details>
<details>
<summary>藏头诗</summary>
@ -1526,17 +1518,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 更新gal
</details>
<details>
<summary>词典匹配回复</summary>
`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/thesaurus"`
- [x] 切换[kimo|傲娇|可爱]词库
- [x] 设置词库触发概率0.x (0<x<9)
- 注:由于占用资源较大,默认注释。
</details>
<details>
<summary>鬼东西</summary>
@ -1574,6 +1555,23 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 设置 ChatGPT api key xxx
</details>
<details>
<summary>词典匹配回复</summary>
`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/thesaurus"`
- [x] 切换[kimo|傲娇|可爱]词库
- [x] 设置词库触发概率0.x (0<x<9)
</details>
<details>
<summary>打断复读</summary>
`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/breakrepeat"`
- [x] (打断三次以上的复读)
</details>
## 三种使用方法,推荐第一种

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.20
require (
github.com/Baidu-AIP/golang-sdk v1.1.1
github.com/FloatTech/AnimeAPI v1.6.1-0.20230316111643-46d40c9d80e3
github.com/FloatTech/floatbox v0.0.0-20230325093157-844e210a5dab
github.com/FloatTech/floatbox v0.0.0-20230325120101-d69494a7cc95
github.com/FloatTech/gg v1.1.2
github.com/FloatTech/imgfactory v0.2.2-0.20230322091809-b0ddbe44b94b
github.com/FloatTech/rendercard v0.0.10-0.20230223064326-45d29fa4ede9

4
go.sum
View File

@ -4,8 +4,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/FloatTech/AnimeAPI v1.6.1-0.20230316111643-46d40c9d80e3 h1:SyXS1YXrRuzO3YVCZB/5gSX7vaFbSMwzN+RXLNNKq5M=
github.com/FloatTech/AnimeAPI v1.6.1-0.20230316111643-46d40c9d80e3/go.mod h1:h+22XrJTgcn0m4aM3o1pYo5G0+Mv4v7wW5xvZQ4LabY=
github.com/FloatTech/floatbox v0.0.0-20230325093157-844e210a5dab h1:Tp+uRcdDBukeSowPDEo2iAux8rCd10VWqglC4a238TI=
github.com/FloatTech/floatbox v0.0.0-20230325093157-844e210a5dab/go.mod h1:FwQm6wk+b4wuW54KCKn3zccMX47Q5apnHD/Yakzv0fI=
github.com/FloatTech/floatbox v0.0.0-20230325120101-d69494a7cc95 h1:wRcdulvceh55bzjXPtqHsKTTil6ipnvAo+uvf4w9LTI=
github.com/FloatTech/floatbox v0.0.0-20230325120101-d69494a7cc95/go.mod h1:FwQm6wk+b4wuW54KCKn3zccMX47Q5apnHD/Yakzv0fI=
github.com/FloatTech/gg v1.1.2 h1:YolgOYg3uDHc1+g0bLtt6QuRA/pvLn+b9IBCIhOOX88=
github.com/FloatTech/gg v1.1.2/go.mod h1:uzPzAeT35egARdRuu+1oyjU3CmTwCceoq3Vvje7LpcI=
github.com/FloatTech/imgfactory v0.2.2-0.20230322091809-b0ddbe44b94b h1:VMNci4SWBySdw/6poqF9Dn9zlT5ntTFSJOEEBjRnJ/4=

View File

@ -150,7 +150,6 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/ygo" // 游戏王相关插件
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/ymgal" // 月幕galgame
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/thesaurus" // 词典匹配回复
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wtf" // 鬼东西
// ^^^^ //
@ -175,6 +174,8 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/ai_reply" // 人工智能回复
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/thesaurus" // 词典匹配回复
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/breakrepeat" // 打断复读
// ^^^^ //

View File

@ -146,10 +146,7 @@ const (
func match(l []string, seg *jieba.Segmenter) zero.Rule {
return func(ctx *zero.Ctx) bool {
if zero.FullMatchRule(l...)(ctx) {
return true
}
return ctxext.JiebaFullMatch(seg, func(ctx *zero.Ctx) string {
return ctxext.JiebaSimilarity(0.5, seg, func(ctx *zero.Ctx) string {
return ctx.ExtractPlainText()
}, l...)(ctx)
}