90 行
3.9 KiB
Python
90 行
3.9 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
全站文案深度分析与 AI 味/啰嗦度检测工具
|
|
"""
|
|
import os
|
|
import re
|
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
TEMPLATES = [
|
|
'addons/official/view/web/official_home/index.html',
|
|
'addons/official/view/web/official_home/index_e.html',
|
|
'addons/official/view/web/official_home/single.html',
|
|
'addons/official/view/web/official_home/single_e.html',
|
|
'addons/official/view/web/official_product/service_page.html',
|
|
'addons/official/view/web/official_product/service_software.html',
|
|
'addons/official/view/web/official_product/service_app.html',
|
|
'addons/official/view/web/official_product/service_agent.html',
|
|
'addons/official/view/web/official_product/product_page.html',
|
|
'addons/official/view/web/official_product/list_e.html',
|
|
'addons/official/view/web/official_case_show/list.html',
|
|
'addons/official/view/web/official_case_show/list_e.html',
|
|
'addons/official/view/web/official_online_message/list.html',
|
|
'addons/official/view/web/official_online_message/list_e.html',
|
|
'addons/official/view/web/official_common/pc/footer.html',
|
|
'addons/official/view/web/official_common/pc/nav.html',
|
|
'addons/official/view/web/official_common/mobile/footer.html',
|
|
'addons/official/view/web/official_common/mobile/nav.html'
|
|
]
|
|
|
|
# AI 味黑名单词库(空洞、宏大叙事、假大空口号、泛化套话、阿里味/公关腔)
|
|
AI_FLAVOR_TERMS = [
|
|
'赋能', '铸造数字生产力', '新纪元', '新篇章', '新范式', '乘风破浪',
|
|
'全方位', '多维度', '深耕', '重器', '基石', '筑牢', '铸牢',
|
|
'大放异彩', '跃迁', '引领', '颠覆', '无可争议', '无懈可击',
|
|
'滴水不漏', '毫无保留', '无论您是', '助力企业全渠道数字化运营',
|
|
'加速企业数字化转型', '助力移动产品极速上架', '准备打造您的专属',
|
|
'全天候守护', '赋能培训', '即开即用,伴随业务快速启航',
|
|
'AI 智能安全库存', 'AI智能安全库存', '开启新一代数字化与智能化升级',
|
|
'工匠精神打造', '深厚一线大型系统经验', '深厚工程积累'
|
|
]
|
|
|
|
# 冗长啰嗦句式模式
|
|
VERBOSE_PATTERNS = [
|
|
r'不仅.*?而且.*?',
|
|
r'为了能够更好地.*?',
|
|
r'致力于为.*?提供.*?',
|
|
r'旨在为.*?打造.*?',
|
|
]
|
|
|
|
def analyze():
|
|
print("=================== 全站文案深度分析报告 ===================")
|
|
total_issues = 0
|
|
for rel_path in TEMPLATES:
|
|
abs_path = os.path.join(BASE_DIR, rel_path.replace('/', os.sep))
|
|
if not os.path.exists(abs_path):
|
|
continue
|
|
with open(abs_path, 'r', encoding='utf-8') as f:
|
|
lines = f.readlines()
|
|
|
|
file_issues = []
|
|
for line_no, line in enumerate(lines, 1):
|
|
text = line.strip()
|
|
# 过滤注释与脚本
|
|
if text.startswith('<!--') and text.endswith('-->'):
|
|
# 检查注释里是否也有未清理的旧口号
|
|
pass
|
|
for term in AI_FLAVOR_TERMS:
|
|
if term in text:
|
|
file_issues.append((line_no, f"AI味词汇: '{term}'", text))
|
|
|
|
for vp in VERBOSE_PATTERNS:
|
|
m = re.search(vp, text)
|
|
if m:
|
|
file_issues.append((line_no, f"啰嗦句式: '{m.group(0)}'", text))
|
|
|
|
if file_issues:
|
|
print(f"\n[{rel_path}] 发现 {len(file_issues)} 处潜在问题:")
|
|
for lno, itype, ltext in file_issues:
|
|
# 截断过长文字
|
|
display_text = ltext if len(ltext) <= 80 else ltext[:80] + '...'
|
|
print(f" 行 {lno:4d} | {itype:25s} | {display_text}")
|
|
total_issues += len(file_issues)
|
|
|
|
print(f"\n=================== 扫描完毕:共检出 {total_issues} 处待优化文案 ===================")
|
|
|
|
if __name__ == '__main__':
|
|
analyze()
|