# -*- coding: utf-8 -*- """第三轮4部短故事全面质量检查""" import re, os rr = re.compile(r'[\u4e00-\u9fff]') repos = [ 'r3-yue-tang-ping-yue-qiang', 'r3-shen-ming-zhong-jie', 'r3-man-ji-da-lao-hui-xin-shou-cun', 'r4-tun-jin-shou-xi-tong', ] repo_names = { 'r3-yue-tang-ping-yue-qiang': '故事1:越躺平越强', 'r3-shen-ming-zhong-jie': '故事2:神明中介', 'r3-man-ji-da-lao-hui-xin-shou-cun': '故事3:满级大佬回新手村', 'r4-tun-jin-shou-xi-tong': '故事4:吞金兽系统', } results = {} for repo in repos: D = os.path.join('/app/working/workspaces/default/check_tmp', repo) name = repo_names[repo] print(f'\n{"="*60}') print(f' {name}') print(f' 仓库: http://git.qihuyun.com/qyyfw/{repo}') print(f'{"="*60}') # 1. 文件完整性 files = sorted([f for f in os.listdir(D) if f.endswith('.md') and '简介' in f]) ch_files = sorted([f for f in os.listdir(D) if f.endswith('.md') and f.startswith('第')]) print(f'\n 📋 章节完整性: {len(ch_files)}章') if len(ch_files) != 15: print(f' ❌ 应15章,实{len(ch_files)}章') else: print(f' ✅ 15章齐全') # 2. 汉字字数 print(f'\n 📊 汉字字数:') total_h = 0 all_ok = True low_chs = [] for f in ch_files: with open(os.path.join(D, f), 'r', encoding='utf-8') as fp: h = len(rr.findall(fp.read())) total_h += h if h < 2000: all_ok = False low_chs.append((f, h)) print(f' ❌ {f}: {h} (不足2000)') avg = total_h // len(ch_files) if ch_files else 0 if all_ok: print(f' ✅ 全部≥2000,总计{total_h}汉字,平均{avg}字/章') else: print(f' ⚠️ {len(low_chs)}章不足2000,总计{total_h}汉字') for f, h in low_chs: print(f' 需补+{2000-h}: {f}') # 3. 敏感词 print(f'\n 🔍 敏感词检查:') sensitive_words = ['裁员', '被裁', '辞退', '集团', '企业'] # '公司'特殊处理:仅标记负面上下文 has_issues = False for f in ch_files: with open(os.path.join(D, f), 'r', encoding='utf-8') as fp: c = fp.read() for w in sensitive_words: if w in c: print(f' ❌ {f}: 含敏感词「{w}」') has_issues = True # 检查'公司'是否出现在负面上下文 for f in ch_files: with open(os.path.join(D, f), 'r', encoding='utf-8') as fp: lines = fp.readlines() for i, l in enumerate(lines): if '公司' in l: # 简单检查上下文是否负面 negative_indicators = ['倒闭', '破产', '裁员', '压榨', '剥削', '违法', '纠纷', '官司', '欠薪', '跑路'] context = l + (lines[i+1] if i+1 < len(lines) else '') + (lines[i-1] if i > 0 else '') for ni in negative_indicators: if ni in context: print(f' ⚠️ {f}: 「公司」在负面上下文(行{i+1}) - {ni}') has_issues = True break if not has_issues: print(f' ✅ 零敏感词问题') # 4. AI味检查 print(f'\n 🤖 AI味检查:') ai_issues = [] for f in ch_files: with open(os.path.join(D, f), 'r', encoding='utf-8') as fp: lines = fp.readlines() c = ''.join(lines) issues = [] cnt = c.count('燃点') if cnt: issues.append(f'燃点×{cnt}') cnt = len(re.findall('深吸[了一]*口气', c)) if cnt > 2: issues.append(f'深吸气×{cnt}(>2)') elif cnt > 0: issues.append(f'深吸气×{cnt}') cnt = len(re.findall('(握紧|攥紧)', c)) if cnt > 4: issues.append(f'握紧/攥紧×{cnt}(>4)') elif cnt > 0: issues.append(f'握紧/攥紧×{cnt}') cnt = sum(1 for l in lines if l.strip() == '——' and len(l.strip()) == 2) if cnt: issues.append(f'独立——行×{cnt}') cnt = c.count('(全书完)') if cnt > 1: issues.append(f'(全书完)重复×{cnt}') cnt = len(re.findall(r'第.*章.*完|本.*章.*完|本章完', c)) if cnt: issues.append(f'章末标注×{cnt}') cnt = len(re.findall('(在我看来|不得不说|毫不夸张地说|可想而知|毋庸置疑)', c)) if cnt > 3: issues.append(f'meta自嘲×{cnt}(>3)') elif cnt > 0: issues.append(f'meta自嘲×{cnt}') if issues: ai_issues.append(f'{f}: {" | ".join(issues)}') if ai_issues: for s in ai_issues: print(f' ⚠️ {s}') else: print(f' ✅ 零AI味问题') # 5. 开篇核弹 (第1章前500字) print(f'\n 💣 开篇核弹V2.0检查:') if ch_files: with open(os.path.join(D, ch_files[0]), 'r', encoding='utf-8') as fp: ch1 = fp.read() first_100 = ch1[:300] # about 100 hanzi first_300 = ch1[:900] # about 300 hanzi first_500 = ch1[:1500] # about 500 hanzi h_100 = len(rr.findall(first_100)) h_300 = len(rr.findall(first_300)) h_500 = len(rr.findall(first_500)) print(f' 前100字区域({h_100}汉字): {"✅" if h_100 >= 50 else "❌"}') print(f' 前300字区域({h_300}汉字): {"✅" if h_300 >= 200 else "❌"}') print(f' 前500字区域({h_500}汉字): {"✅" if h_500 >= 400 else "❌"}') # 检查前100字是否有冲突 conflict_keywords = ['分手', '被甩', '完蛋', '完了', '被裁', '开除', '被骂', '破产', '欠债', '被嘲', '被笑', '被打了', '冲突', '矛盾', '决裂', '背叛', '被坑', '被骗'] has_conflict = any(kw in first_100 for kw in conflict_keywords) print(f' 前100字出冲突: {"✅ 有" if has_conflict else "⚠️ 未检测到明确冲突"}') # 检查前300字是否兑现书名 print(f' 前300字兑现书名: 需人工判断标题核心要素是否出现') # 差异化钩子 spec_hooks = ['系统', '觉醒', '金手指', '绑定', '激活', '穿越', '重生', '特殊能力', '不一样', '别人不知道'] has_hook = any(kw in first_500 for kw in spec_hooks) print(f' 前500字差异化钩子: {"✅ 有" if has_hook else "⚠️ 未检测到明确钩子"}') # 6. 剧情连贯性抽样 print(f'\n 🔗 剧情连贯性(抽样):') sample_gaps = [] for i in range(1, len(ch_files)): with open(os.path.join(D, ch_files[i-1]), 'r', encoding='utf-8') as fp: prev_end = fp.readlines()[-5:] with open(os.path.join(D, ch_files[i]), 'r', encoding='utf-8') as fp: curr_start = fp.readlines()[:5] prev_last = ''.join(prev_end)[-200:] curr_first = ''.join(curr_start)[:200] # 简单检查是否有明显断裂(主题跳跃) # 仅做提示 print(f' 章与章之间剧情连续(需人工通读确认)') # 综合评级 score = 0 if len(ch_files) == 15: score += 20 if all_ok: score += 30 if not has_issues: score += 20 if not ai_issues: score += 20 grade = 'S' if score >= 85 else ('A' if score >= 70 else 'B') print(f'\n 🏆 综合评分: {score}/90 → {grade}级') results[repo] = {'score': score, 'grade': grade, 'total_h': total_h, 'avg': avg} print(f'\n{"="*60}') print(f' 第三轮4部短故事全面检查报告') print(f'{"="*60}') print(f'{"故事":<20} {"汉字":<8} {"平均":<8} {"评分":<8} {"等级":<8}') print(f'{"-"*52}') for repo, r in results.items(): n = repo_names[repo] print(f'{n:<20} {r["total_h"]:<8} {r["avg"]:<8} {r["score"]:<8} {r["grade"]:<8}') print(f'{"-"*52}')