文件
nahaichuan/tests/test_natural_copywriting.py

308 行
12 KiB
Python

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

"""
纯粹务实工程文案专项测试 (Natural Copywriting & No AI Buzzwords Test)
测试驱动去 AI 化、去除泛化通用口号与翻译腔,强化大厂务实工程与业务场景语言。
"""
import os
import unittest
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
class TestNaturalCopywriting(unittest.TestCase):
def setUp(self):
self.index_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_home/index.html"
)
self.services_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_product/service_page.html"
)
self.products_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_product/product_page.html"
)
self.cases_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_case_show/list.html"
)
self.about_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_home/single.html"
)
self.contact_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_online_message/list.html"
)
with open(self.index_path, encoding="utf-8") as f:
self.index_html = f.read()
with open(self.services_path, encoding="utf-8") as f:
self.services_html = f.read()
with open(self.products_path, encoding="utf-8") as f:
self.products_html = f.read()
with open(self.cases_path, encoding="utf-8") as f:
self.cases_html = f.read()
with open(self.about_path, encoding="utf-8") as f:
self.about_html = f.read()
with open(self.contact_path, encoding="utf-8") as f:
self.contact_html = f.read()
self.footer_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_common/pc/footer.html"
)
with open(self.footer_path, encoding="utf-8") as f:
self.footer_html = f.read()
def test_forbid_ai_buzzwords_and_translationese(self):
"""严格禁止典型 AI 假大空口号、翻译腔与泛化套话"""
self.footer_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_common/pc/footer.html"
)
with open(self.footer_path, encoding="utf-8") as f:
self.footer_html = f.read()
ai_buzzwords = [
"准备好与资深技术架构师展开深度研讨了吗", # 翻译腔
"认知智能化”跃迁", # 虚浮AI词
"数字见证力量", # 泛化套话
"开启确定性数字化未来", # 泛化套话
"让您的企业也拥有经得起考验的", # AI祈使句
"开启您的企业数字化与智能化升级项目", # 泛化套话
"开启确定性数字化技术合作", # 虚词
"严谨商务 · 现代中式 · 高级感专业软件服务", # 泄露的设计Prompt
"现代中式 · 高级感",
"研发委员会",
"技术委员会",
"原创技术资产",
"工程受控说明",
"白盒交付",
"白盒源码",
"带病代码",
"杜绝系统带病上线",
"西南数谷",
]
all_html = (
self.index_html
+ "\n"
+ self.services_html
+ "\n"
+ self.products_html
+ "\n"
+ self.cases_html
+ "\n"
+ self.about_html
+ "\n"
+ self.contact_html
+ "\n"
+ self.footer_html
)
for buzzword in ai_buzzwords:
self.assertNotIn(
buzzword,
all_html,
f"全站必须彻底剔除 AI 通用套话/提示词残留: '{buzzword}'",
)
def test_require_pragmatic_engineering_copy(self):
"""必须包含具体务实的工程化、场景化语言"""
# 首页务实表达
self.assertIn(
"系统开发与长期维护",
self.index_html,
"首页服务板块标题必须务实直接",
)
self.assertIn(
"标准化业务系统",
self.index_html,
"首页产品板块标题必须去数词、说清范围",
)
self.assertIn(
"项目案例:业务挑战与技术方案",
self.index_html,
"首页案例板块标题必须去数词、说清内容",
)
self.assertIn(
"项目推进流程",
self.index_html,
"首页流程板块标题必须务实清晰",
)
self.assertIn("客户反馈", self.index_html, "首页评价板块标题必须务实")
self.assertIn(
"有具体的系统研发或产品选型需求?可以直接沟通",
self.index_html,
"首页CTA必须说人话、重落实",
)
# 服务页务实表达
self.assertIn(
"带着您的系统需求或技术难题,直接与架构师沟通",
self.services_html,
"服务页CTA必须杜绝翻译腔",
)
# 案例页务实表达
self.assertIn(
"你的业务也遇到类似问题?",
self.cases_html,
"案例页CTA必须直接回应客户问题",
)
# 关于我们与联系我们
self.assertTrue(
any(
text in self.about_html
for text in (
"找懂业务、讲规范的研发团队,让软件项目平稳落地",
"沟通您的软件建设需求",
)
),
"关于我们CTA必须务实接地气",
)
self.assertIn(
"业务咨询与技术评估", self.contact_html, "联系我们标题必须清晰务实"
)
def test_user_removal_of_copyright_metric_in_hero(self):
"""首屏Hero必须彻底移除用户指明的'50+ 国家软件著作权资产'"""
self.assertNotIn(
"国家软件著作权资产",
self.index_html,
"首屏Hero严禁包含用户要求去掉的'国家软件著作权资产'",
)
def test_user_removal_of_cases_data_wall(self):
"""案例独立页(PC与移动端)必须彻底移除'50亿+ 交易额'等悬浮泛化数字指标墙"""
# PC端
self.assertNotIn(
"nhc-case-metrics-section",
self.cases_html,
"PC案例页必须彻底移除成果数据指标墙大板块",
)
self.assertNotIn(
"系统累计支撑交易额",
self.cases_html,
"PC案例页严禁展示浮夸的'系统累计支撑交易额'",
)
self.assertNotIn(
"标杆政企与行业组织",
self.cases_html,
"PC案例页严禁展示浮夸的'标杆政企与行业组织'",
)
self.assertNotIn(
"项目按期高质量交付率",
self.cases_html,
"PC案例页严禁展示浮夸的'项目按期高质量交付率'",
)
# 移动端
mobile_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_case_show/list_e.html"
)
with open(mobile_path, encoding="utf-8") as f:
mobile_html = f.read()
self.assertNotIn(
"支撑交易总额", mobile_html, "移动端案例页严禁展示'支撑交易总额'"
)
self.assertNotIn(
"标杆合作组织", mobile_html, "移动端案例页严禁展示'标杆合作组织'"
)
self.assertNotIn("按期交付率", mobile_html, "移动端案例页严禁展示'按期交付率'")
def test_deep_no_ai_flavor_and_concise_copy(self):
"""深度检查文案:彻底杜绝 AI 口味、大词堆砌、公关腔与啰嗦句式"""
# 读取移动端首页及其他独立页面
index_e_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_home/index_e.html"
)
single_e_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_home/single_e.html"
)
service_software_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_product/service_software.html"
)
service_app_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_product/service_app.html"
)
service_agent_path = os.path.join(
ROOT_DIR, "addons/official/view/web/official_product/service_agent.html"
)
with open(index_e_path, encoding="utf-8") as f:
index_e_html = f.read()
with open(single_e_path, encoding="utf-8") as f:
single_e_html = f.read()
with open(service_software_path, encoding="utf-8") as f:
service_software_html = f.read()
with open(service_app_path, encoding="utf-8") as f:
service_app_html = f.read()
with open(service_agent_path, encoding="utf-8") as f:
service_agent_html = f.read()
all_text = (
self.index_html
+ "\n"
+ index_e_html
+ "\n"
+ self.services_html
+ "\n"
+ service_software_html
+ "\n"
+ service_app_html
+ "\n"
+ service_agent_html
+ "\n"
+ self.products_html
+ "\n"
+ self.cases_html
+ "\n"
+ self.about_html
+ "\n"
+ single_e_html
+ "\n"
+ self.contact_html
+ "\n"
+ self.footer_html
)
forbidden_ai_copy = [
"铸造数字生产力",
"开启新一代数字化与智能化升级",
"赋能复杂业务流转",
"助力移动产品极速上架",
"准备打造您的专属",
"助力企业全渠道数字化运营",
"AI 智能安全库存",
"AI智能安全库存",
"即开即用,伴随业务快速启航",
"全天候守护",
"赋能培训",
"加速企业数字化转型",
"无可争议",
"毫无保留",
"工匠精神打造",
"滴水不漏",
# 已从首页清除的无出处数据与绝对化结果描述,防止回潮
"99.8% 按期交付率",
"50+ 自主软著资产",
"200+ 政企标杆客户",
"300 家连锁门店",
"库存对账零误差",
]
for item in forbidden_ai_copy:
self.assertNotIn(item, all_text, f"全站模板仍残留AI味或啰嗦表述: '{item}'")
# 验证新优化的务实干练文案已生效
self.assertIn("成熟商业系统 · 支撑全渠道经营与业务协同", self.products_html)
self.assertIn("动态安全库存模型与自动补货采购建议", self.products_html)
self.assertIn("企业知识问答", service_agent_html)
self.assertIn("业务流程辅助", service_agent_html)
self.assertIn(
"检索增强可以降低错误风险,但不能保证所有回答都正确", service_agent_html
)
self.assertNotIn("不会自己编造", service_agent_html)
self.assertNotIn("一张或两张显卡即可", service_agent_html)
self.assertIn("根据使用方式,选择合适的终端", service_app_html)
self.assertIn("应用审核结果与排期由平台决定", service_app_html)
self.assertNotIn("上架一次通过率", service_app_html)
self.assertNotIn("全生态", service_app_html)
self.assertIn("全量规范移交客户", self.services_html)
if __name__ == "__main__":
unittest.main()