Files
2026-06-19 06:38:31 +00:00

68 lines
4.8 KiB
Python

import os, re
bases = {
'①系统内卷': '/app/working/workspaces/default/novels/r2-xi-tong-nei-juan',
'②全基地替身': '/app/working/workspaces/default/novels/r2-quan-ji-di-ti-shen',
'③考研骑手': '/app/working/workspaces/default/novels/r2-quan-ban-kao-yan',
'④AI修脚': '/app/working/workspaces/default/novels/r2-ai-xiu-jiao',
}
print('=' * 80)
print('AI味扫描 + 完整度报告')
print('=' * 80)
for name, base in bases.items():
files = sorted([f for f in os.listdir(base) if f.endswith('.md') and f != 'README.md'])
if not files:
print(f'\n{name}: 无文件')
continue
all_text = ''
total_bytes = 0
min_b = 999999
max_b = 0
min_f = ''
max_f = ''
dash_lines = 0
shen_xi = 0
wo_jin = 0
leng_guang = 0
end_mark = 0
ran = 0
pai_bi = 0
for f in files:
fp = os.path.join(base, f)
with open(fp, 'r') as fh:
text = fh.read()
b = len(text.encode('utf-8'))
total_bytes += b
all_text += text
if b < min_b:
min_b = b
min_f = f
if b > max_b:
max_b = b
max_f = f
lines = text.split('\n')
for line in lines:
s = line.strip()
if s in ('——', '————', '——————'):
dash_lines += 1
shen_xi += len(re.findall(r'深吸一口气|深呼一口气', text))
wo_jin += len(re.findall(r'握紧|攥紧|捏紧', text))
leng_guang += len(re.findall(r'冷光|屏幕.*闪|闪烁', text))
end_mark += len(re.findall(r'第[一二三四五六七八九十百]+章.*完', text))
ran += len(re.findall(r'燃[点爆]|热血沸腾', text))
pai_bi += len(re.findall(r'排比|句式工整|整齐划一', text))
hanzi = len(re.findall(r'[\u4e00-\u9fff]', all_text))
avg_b = total_bytes / len(files) if files else 0
# 报告
print(f'\next))\n avg_b = total_bytes / len(files) if files else 0\n \n # 报告\n print(f'\\n{"─" * 40}')\n print(f'{name}')\n print(f'{\"─\" * 40}')\n print(f' 章数: {len(files)}')\n print(f' 总汉字: ~{hanzi}')\n print(f' 均size: {avg_b:.0f} b/章 | 最薄: {min_f} ({min_b}b) | 最厚: {max_f} ({max_b}b)')\n print()\n \n # AI味指标\n print(f' AI味指标:')\n \n # ——密度\n dd = dash_lines / len(files)\n if dd > 1.5:\n status = '⚠️ 偏高'\n elif dd > 1.0:\n status = '△ 轻微'\n else:\n status = '✅ 正常'\n print(f' ——独立行: {dash_lines}处 ({dd:.1f}/章) {status}')\n \n # 深吸一口气\n if shen_xi >= 3:\n status = '⚠️ 偏高'\n elif shen_xi >= 1:\n status = '△ 轻微'\n else:\n status = '✅ 正常'\n print(f' 深吸一口气: {shen_xi}处 {status}')\n \n # 握紧/攥紧\n if wo_jin >= 8:\n status = '⚠️ 偏高'\n elif wo_jin >= 3:\n status = '△ 轻微'\n else:\n status = '✅ 正常'\n print(f' 握紧/攥紧/捏紧: {wo_jin}处 {status}')\n \n # 燃点\n if ran >= 1:\n status = '⚠️ 存在燃点标签'\n else:\n status = '✅ 无'\n print(f' 燃点标签: {status}')\n \n # 章末标注\n if end_mark >= 1:\n status = f'🚩 存在({end_mark}处)'\n else:\n status = '✅ 无'\n print(f' (第X章完)标记: {status}')\n \n # 冷光\n if leng_guang >= 3:\n status = '⚠️ 偏多'\n elif leng_guang >= 1:\n status = '△ 轻微'\n else:\n status = '✅ 正常'\n print(f' 冷光/屏幕闪烁: {leng_guang}处 {status}')\n \n # 完整度打分\n print(f' 完整度: ', end='')\n thin = sum(1 for f in files if os.path.getsize(os.path.join(base, f)) < 1200)\n if thin == 0:\n print(f'✅ 全部章节≥1200b')\n else:\n print(f'⚠️ {thin}章偏薄(<1200b)')\n \n print(f' 综合评分: ', end='')\n score = 100\n deductions = []\n if dd > 1.5:\n score -= 10\n deductions.append('——过密(-10)')\n if shen_xi >= 3:\n score -= 10\n deductions.append('深吸气(-10)')\n if wo_jin >= 8:\n score -= 10\n deductions.append('握紧(-10)')\n if ran >= 1:\n score -= 15\n deductions.append('燃点(-15)')\n if end_mark >= 1:\n score -= 15\n deductions.append('章末标注(-15)')\n if thin > 2:\n score -= 10\n deductions.append(f'{thin}章偏薄(-10)')\n if min_b < 1000:\n score -= 5\n deductions.append(f'最短<1000b(-5)')\n \n if deductions:\n print(f'{score}/100 {\" | \".join(deductions)}')\n else:\n print(f'{score}/100 ✅ 优秀')\n\nprint(f'\\n{\"=\" * 80}')\nprint('扫描完成')\nprint('=' * 80)\n"
}