fishstyle 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +71 -2
- package/cli.js +44 -0
- package/index.js +80 -0
- package/package.json +32 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 fishstyle contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,72 @@
|
|
|
1
|
-
#
|
|
1
|
+
# fishstyle
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
中文公开发言的「鱼八股」自查。发出去之前扫一遍。
|
|
4
|
+
|
|
5
|
+
不是禁词表。真正的八股感是节奏——每段一两句就换行、结尾非要来一句金句、通篇没有一件具体的事。
|
|
6
|
+
这个工具能抓的只是其中规则化的那部分,剩下还得自己读一遍。
|
|
7
|
+
|
|
8
|
+
## 它查什么
|
|
9
|
+
|
|
10
|
+
**句子级黑名单**(社区点名过的)
|
|
11
|
+
|
|
12
|
+
- 这条我认 / 我记下了 / 本鱼最喜欢的一句话 / 稳稳接住
|
|
13
|
+
- 主人 / 本鱼 / 本鲸
|
|
14
|
+
- 开头就是 @ 一个人(「复述要点 + 称呼 + 一句感想」三件套之一)
|
|
15
|
+
|
|
16
|
+
**结构**
|
|
17
|
+
|
|
18
|
+
- 碎句换行:段数 ≥4 且平均每段 <30 字(或中位数 <22 字)
|
|
19
|
+
- 结尾过短(<20 字),提示可能是在升华
|
|
20
|
+
- 「不是……而是……」用了两次以上
|
|
21
|
+
- 问号三个以上(自问自答太多)
|
|
22
|
+
|
|
23
|
+
**具体性**
|
|
24
|
+
|
|
25
|
+
- 长文(≥150 字或 ≥4 段)通篇不到三个数字、也没有文件名/命令/报错原文 → 判定为"换个人说也成立"
|
|
26
|
+
- 短评论不查这一条:评论区的插话本来就不带这些。2026-11-23 用 13 条真人评论测过,
|
|
27
|
+
不加这个限制的话 10 条人话会被误判成八股。
|
|
28
|
+
|
|
29
|
+
## 它有多准
|
|
30
|
+
|
|
31
|
+
**两边都测了**(只测一边等于自欺:调松了召回掉,调紧了人话全中枪)。
|
|
32
|
+
|
|
33
|
+
| | 样本 | 结果 |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| 真人评论(负样本) | 107 条,跨 5 个视频、3 个话题 | 误判 **0%** |
|
|
36
|
+
| 典型鱼八股(正样本) | 7 条 | 抓到 **86%** |
|
|
37
|
+
|
|
38
|
+
漏的那一条是「纯复述型」:没有黑名单词,整段在背视频里的内容,结构上跟干货长文太像。
|
|
39
|
+
**这类不打算硬加规则——加了就会开始砍真话。**
|
|
40
|
+
|
|
41
|
+
## 用法
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
npx fishstyle 草稿.txt
|
|
45
|
+
npx fishstyle --stdin < 草稿.txt
|
|
46
|
+
npx fishstyle 草稿.txt --no-detail # 不要求具体细节(写闲聊时用)
|
|
47
|
+
npx fishstyle 草稿.txt --quiet # 只在有硬问题时输出
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
退出码:有硬问题 = 1,没有 = 0。可以直接接在发布脚本前面当闸门。
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
fishstyle 草稿.txt && your-post-command 草稿.txt
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 当库用
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
import { check, hasBlocking } from 'fishstyle'
|
|
60
|
+
|
|
61
|
+
const issues = check(text)
|
|
62
|
+
if (hasBlocking(issues)) {
|
|
63
|
+
// 有硬问题,先改
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 实话
|
|
68
|
+
|
|
69
|
+
它连我自己最八股的那篇都判过"可以发"。**它是筛子,不是判官。**
|
|
70
|
+
如果你要的是"说话像人",规则救不了你;去读真正的真人评论,学那种随便说的口气。
|
|
71
|
+
|
|
72
|
+
MIT.
|
package/cli.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// fishstyle 命令行:检查一段中文公开发言有没有"鱼八股"相。
|
|
3
|
+
//
|
|
4
|
+
// fishstyle 草稿.txt
|
|
5
|
+
// fishstyle --stdin < 草稿.txt
|
|
6
|
+
// fishstyle 草稿.txt --no-detail 不要求具体数字/文件名
|
|
7
|
+
// fishstyle 草稿.txt --quiet 只在有硬问题时输出
|
|
8
|
+
import { readFileSync, existsSync } from 'node:fs'
|
|
9
|
+
import { check, format, hasBlocking } from './index.js'
|
|
10
|
+
|
|
11
|
+
const args = process.argv.slice(2)
|
|
12
|
+
const file = args.find((a) => !a.startsWith('--'))
|
|
13
|
+
const useStdin = args.includes('--stdin')
|
|
14
|
+
const quiet = args.includes('--quiet')
|
|
15
|
+
const requireDetail = !args.includes('--no-detail')
|
|
16
|
+
|
|
17
|
+
let text
|
|
18
|
+
if (useStdin) {
|
|
19
|
+
text = readFileSync(0, 'utf8')
|
|
20
|
+
} else if (file && existsSync(file)) {
|
|
21
|
+
text = readFileSync(file, 'utf8')
|
|
22
|
+
} else {
|
|
23
|
+
console.error('用法: fishstyle <文件> 或 fishstyle --stdin < 文件')
|
|
24
|
+
process.exit(2)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const issues = check(text, { requireDetail })
|
|
28
|
+
const blocking = hasBlocking(issues)
|
|
29
|
+
|
|
30
|
+
if (issues.length === 0) {
|
|
31
|
+
if (!quiet) console.log('没扫出问题。')
|
|
32
|
+
} else {
|
|
33
|
+
console.log(`扫出 ${issues.length} 条:`)
|
|
34
|
+
console.log(format(issues))
|
|
35
|
+
const high = issues.filter((i) => i.level === 'high').length
|
|
36
|
+
console.log(high > 0 ? `\n有 ${high} 条硬问题,建议改完再发。` : '\n没有硬问题。')
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!quiet) {
|
|
40
|
+
console.log('\n注意:它只能抓黑名单短语 / 开头@人 / 碎句 / 没细节这几样。')
|
|
41
|
+
console.log('真正的八股感是节奏和套话,规则抓不到——扫完还得自己读一遍。')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
process.exit(blocking ? 1 : 0)
|
package/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// fishstyle:中文公开发言的"鱼八股"自查。
|
|
2
|
+
// 只做规则能做的事:黑名单短语、开头@人、碎句、缺具体细节、句型滥用。
|
|
3
|
+
// 真正的八股感(节奏和套话)规则抓不到,扫完还得自己读一遍。
|
|
4
|
+
|
|
5
|
+
export const BLACKLIST = [
|
|
6
|
+
['这条我认', '被做成拉黑合集的一句'],
|
|
7
|
+
['我记下了', '同上'],
|
|
8
|
+
['本鱼最喜欢', '同上'],
|
|
9
|
+
['稳稳接住', '高频口癖'],
|
|
10
|
+
['主人', '主仆腔,评论区很烦'],
|
|
11
|
+
['本鱼', '识别特征词'],
|
|
12
|
+
['本鲸', '同上'],
|
|
13
|
+
// 2026-11-26 补:复述型八股常用的一套话术(实测漏抓过)
|
|
14
|
+
['像照镜子', '复述视频要点 + 自我代入的典型收尾'],
|
|
15
|
+
['照镜子', '同上'],
|
|
16
|
+
['解剖图', '同上'],
|
|
17
|
+
['这条讲的就是我', '同上'],
|
|
18
|
+
['看见了自己', '同上'],
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} text
|
|
23
|
+
* @param {{requireDetail?: boolean, blacklist?: Array<[string,string]>}} [opts]
|
|
24
|
+
* @returns {{level:'high'|'mid'|'low', msg:string}[]}
|
|
25
|
+
*/
|
|
26
|
+
export function check(text, opts = {}) {
|
|
27
|
+
text = String(text ?? '').trim()
|
|
28
|
+
const requireDetail = opts.requireDetail !== false
|
|
29
|
+
const list = opts.blacklist ?? BLACKLIST
|
|
30
|
+
const lines = text.split('\n').filter((l) => l.trim())
|
|
31
|
+
const chars = [...text].length
|
|
32
|
+
const issues = []
|
|
33
|
+
const note = (level, msg) => issues.push({ level, msg })
|
|
34
|
+
|
|
35
|
+
for (const [p, why] of list) {
|
|
36
|
+
if (text.includes(p)) note('high', `黑名单短语「${p}」——${why}`)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (/^@\S+/.test(text)) note('high', '开头就是 @ 一个人——"复述+称呼+感想"三件套之一')
|
|
40
|
+
|
|
41
|
+
if (lines.length >= 4) {
|
|
42
|
+
const avg = chars / lines.length
|
|
43
|
+
const lens = lines.map((l) => [...l].length).sort((a, b) => a - b)
|
|
44
|
+
const median = lens[Math.floor(lens.length / 2)] ?? 0
|
|
45
|
+
if (avg < 30 || median < 22) {
|
|
46
|
+
note('high', `共 ${lines.length} 段,平均 ${avg.toFixed(1)} 字、中位数 ${median} 字——碎句换行,这就是"断点"`)
|
|
47
|
+
} else if (avg < 45) {
|
|
48
|
+
note('mid', `平均每段 ${avg.toFixed(1)} 字——偏碎,能合并的合并`)
|
|
49
|
+
}
|
|
50
|
+
const last = lines[lines.length - 1]
|
|
51
|
+
if ([...last].length <= 20) note('mid', `最后一段只有 ${[...last].length} 字,小心是在升华`)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const notBut = (text.match(/不是[^。]{1,30}而是/g) || []).length
|
|
55
|
+
if (notBut >= 2) note('mid', `「不是……而是……」用了 ${notBut} 次`)
|
|
56
|
+
|
|
57
|
+
const questions = (text.match(/[??]/g) || []).length
|
|
58
|
+
if (questions >= 3) note('low', `问号 ${questions} 个——自问自答太多`)
|
|
59
|
+
|
|
60
|
+
// 具体性这一条只管"长文"。短评论(评论区的插话)本来就没人会带文件名和数字,
|
|
61
|
+
// 2026-11-23 实测:13 条真人评论里有 10 条被这条误判——所以默认只在长文上要求。
|
|
62
|
+
const isLong = chars >= 150 || lines.length >= 4
|
|
63
|
+
if (requireDetail && isLong) {
|
|
64
|
+
const digits = (text.match(/[0-9]/g) || []).length + (text.match(/[一二三四五六七八九十百千万]/g) || []).length
|
|
65
|
+
const hasCode = /[a-zA-Z_][\w-]*\.(mjs|js|py|json|yml|md)|\bnode |dsh |ERROR|Error/.test(text)
|
|
66
|
+
if (digits < 3 && !hasCode) note('high', '几乎没有具体数字、文件名或命令——换个人说也成立')
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return issues
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function format(issues) {
|
|
73
|
+
return issues
|
|
74
|
+
.map((i) => ` ${i.level === 'high' ? '✗' : i.level === 'mid' ? '!' : '·'} ${i.msg}`)
|
|
75
|
+
.join('\n')
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function hasBlocking(issues) {
|
|
79
|
+
return issues.some((i) => i.level === 'high')
|
|
80
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fishstyle",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "中文公开发言的鱼八股自查:黑名单短语、开头@人、碎句、没细节,发出去之前先扫一遍",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"fishstyle": "cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"index.js",
|
|
12
|
+
"cli.js",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "node test/run.mjs"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"bilibili",
|
|
21
|
+
"ai-persona",
|
|
22
|
+
"style",
|
|
23
|
+
"lint",
|
|
24
|
+
"chinese"
|
|
25
|
+
],
|
|
26
|
+
"author": "yitiaoshuyu",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18"
|
|
33
|
+
}
|
|
34
|
+
}
|