91 lines
2.6 KiB
Python
91 lines
2.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
import re, os
|
|
|
|
D = '/app/working/workspaces/default/novels/round3/03-满级大佬回新手村'
|
|
rr = re.compile(r'[\u4e00-\u9fff]')
|
|
|
|
print('=== 1. 章节完整性 ===')
|
|
files = sorted([f for f in os.listdir(D) if f.endswith('.md') and f.startswith('第')])
|
|
print(f' 共 {len(files)} 章')
|
|
for f in files:
|
|
print(f' {f}')
|
|
|
|
print('\n=== 2. 汉字字数 ===')
|
|
for f in files:
|
|
with open(os.path.join(D, f), 'r', encoding='utf-8') as fp:
|
|
h = len(rr.findall(fp.read()))
|
|
flag = 'OK' if h >= 2000 else 'NEED'
|
|
print(f' {flag} {f}: {h}')
|
|
|
|
print('\n=== 3. 敏感词检查 ===')
|
|
sensitive = [
|
|
('公司负面', '公[^告]?司'),
|
|
('集团', '集团'),
|
|
('企业', '企业'),
|
|
('裁员/辞退/被裁', '(被裁|裁员|辞退)'),
|
|
('被替代/被代替', '(被替代|被代替)'),
|
|
]
|
|
found = 0
|
|
for f in files:
|
|
with open(os.path.join(D, f), 'r', encoding='utf-8') as fp:
|
|
c = fp.read()
|
|
for name, pat in sensitive:
|
|
m = re.findall(pat, c)
|
|
if m:
|
|
found += 1
|
|
print(f' ⚠️ {f}: {name} -> {m}')
|
|
if found == 0:
|
|
print(' ✅ 无敏感词')
|
|
|
|
print('\n=== 4. AI味检查 ===')
|
|
issues = 0
|
|
for f in files:
|
|
with open(os.path.join(D, f), 'r', encoding='utf-8') as fp:
|
|
c = fp.read()
|
|
|
|
# 深吸
|
|
n1 = c.count('深吸')
|
|
if n1 > 2:
|
|
issues += 1
|
|
print(f' ⚠️ {f}: 深吸{n1}次(>2)')
|
|
|
|
# 握紧/攥紧
|
|
n2 = c.count('握紧') + c.count('攥紧')
|
|
if n2 > 4:
|
|
issues += 1
|
|
print(f' ⚠️ {f}: 握紧/攥紧{n2}次(>4)')
|
|
|
|
# 独立行——
|
|
lines = c.split('\n')
|
|
for i, line in enumerate(lines):
|
|
s = line.strip()
|
|
if s == '——':
|
|
issues += 1
|
|
print(f' ⚠️ {f}: 独立行—— (行{i+1})')
|
|
|
|
# 燃点
|
|
if '燃点' in c:
|
|
issues += 1
|
|
print(f' ⚠️ {f}: 含燃点')
|
|
|
|
# 章末标注
|
|
if '(第' in c and '(完)' in c:
|
|
issues += 1
|
|
print(f' ⚠️ {f}: 含章末标注')
|
|
|
|
if issues == 0:
|
|
print(' ✅ 无AI味问题')
|
|
|
|
print('\n=== 5. 开篇核弹检查(第1章前500字) ===')
|
|
ch1_file = files[0]
|
|
with open(os.path.join(D, ch1_file), 'r', encoding='utf-8') as fp:
|
|
ch1 = fp.read()
|
|
first_500 = ch1[:1000]
|
|
rr_hz_500 = len(rr.findall(first_500))
|
|
print(f' 前500字区域汉字数: {rr_hz_500}')
|
|
print(f' 前200字: {ch1[:200]}')
|
|
print(f' 前300-500字: {ch1[200:600]}')
|
|
|
|
print('\n=== 总汉字数 ===')
|
|
total = sum(len(rr.findall(open(os.path.join(D, f),'r',encoding='utf-8').read())) for f in files)
|
|
print(f' {total} 汉字,平均 {total//len(files)}/章') |