164 lines
4.4 KiB
Python
164 lines
4.4 KiB
Python
#!/usr/bin/env python3
|
||
"""
|
||
Anti-AI Detector 测试脚本
|
||
"""
|
||
|
||
import sys
|
||
sys.path.insert(0, '/home/ubuntu/.nanobot/workspace/skills/anti-ai-detector')
|
||
|
||
from humanize import AntiAIDetector
|
||
from it_integration import ITContentHumanizer, humanize_for_it_news, humanize_for_xiaohongshu
|
||
|
||
|
||
def test_chinese():
|
||
"""测试中文去AI化"""
|
||
print("="*60)
|
||
print("测试1: 中文去AI化")
|
||
print("="*60)
|
||
|
||
text = """
|
||
值得注意的是,这项技术非常重要。我们可以看到,随着AI的发展,
|
||
越来越多的应用场景被开发出来。首先,它提高了效率;其次,
|
||
它降低了成本;最后,它改变了工作方式。综上所述,
|
||
这项技术毫无疑问具有极其重要的意义。
|
||
"""
|
||
|
||
detector = AntiAIDetector()
|
||
result = detector.humanize_cn(text)
|
||
|
||
print("原文:")
|
||
print(text.strip())
|
||
print("\n去AI化后:")
|
||
print(result)
|
||
print()
|
||
|
||
|
||
def test_english():
|
||
"""测试英文去AI化"""
|
||
print("="*60)
|
||
print("测试2: 英文去AI化 (Stop Slop)")
|
||
print("="*60)
|
||
|
||
text = """
|
||
Here's the thing: building great products is hard. It turns out that
|
||
most teams struggle with alignment. Not because they lack talent.
|
||
Because they lack clarity. Let that sink in.
|
||
|
||
The uncomfortable truth is that most advice is generic. Let me be clear:
|
||
speed without direction is just chaos. We need to navigate the complex
|
||
landscape of product development and leverage our resources effectively.
|
||
"""
|
||
|
||
detector = AntiAIDetector()
|
||
result = detector.humanize_en(text)
|
||
|
||
print("原文:")
|
||
print(text.strip())
|
||
print("\n去AI化后:")
|
||
print(result)
|
||
print()
|
||
|
||
|
||
def test_xiaohongshu():
|
||
"""测试小红书风格"""
|
||
print("="*60)
|
||
print("测试3: 小红书风格优化")
|
||
print("="*60)
|
||
|
||
text = """
|
||
姐妹们!今天给大家分享一个宝藏神器!🔥🔥🔥
|
||
|
||
1️⃣ 首先,这个产品真的绝绝子!
|
||
2️⃣ 其次,效果YYDS!
|
||
3️⃣ 最后,闭眼入不踩雷!
|
||
|
||
强烈推荐大家码住这个干货!✅✅✅
|
||
#好物推荐 #必买清单 #宝藏神器
|
||
"""
|
||
|
||
detector = AntiAIDetector()
|
||
result = detector.humanize_xhs(text)
|
||
|
||
print("原文:")
|
||
print(text.strip())
|
||
print("\n优化后:")
|
||
print(result)
|
||
print()
|
||
|
||
|
||
def test_it_integration():
|
||
"""测试IT资讯集成"""
|
||
print("="*60)
|
||
print("测试4: IT资讯项目集成")
|
||
print("="*60)
|
||
|
||
content = {
|
||
'title': '深度解析:揭秘AI技术的十大不为人知的秘密',
|
||
'translated': """
|
||
值得注意的是,这项技术非常重要。我们可以看到,随着AI的发展,
|
||
越来越多的应用场景被开发出来。
|
||
""",
|
||
'summary': """
|
||
首先,AI提高了效率;其次,它降低了成本;最后,它改变了工作方式。
|
||
综上所述,这项技术毫无疑问具有极其重要的意义。
|
||
""",
|
||
'platform': 'xiaohongshu'
|
||
}
|
||
|
||
humanizer = ITContentHumanizer()
|
||
result = humanizer.full_pipeline(content)
|
||
|
||
print("原标题:", content['title'])
|
||
print("优化标题:", result['title'])
|
||
print("\n优化总结:")
|
||
print(result['summary'])
|
||
print()
|
||
|
||
|
||
def test_analysis():
|
||
"""测试AI痕迹分析"""
|
||
print("="*60)
|
||
print("测试5: AI痕迹风险分析")
|
||
print("="*60)
|
||
|
||
text = """
|
||
Here's the thing: 值得注意的是,这项技术非常重要。
|
||
我们可以看到,随着AI的发展,越来越多的应用场景被开发出来。
|
||
Let that sink in. 首先,它提高了效率;其次,它降低了成本。
|
||
"""
|
||
|
||
humanizer = ITContentHumanizer()
|
||
risk = humanizer.analyze_risk(text)
|
||
|
||
print("分析文本:")
|
||
print(text.strip())
|
||
print(f"\n风险等级: {risk['risk_level']}")
|
||
print(f"得分: {risk['score']}")
|
||
print("建议:")
|
||
for s in risk['suggestions']:
|
||
print(f" - {s}")
|
||
print()
|
||
|
||
|
||
def main():
|
||
"""运行所有测试"""
|
||
print("\n")
|
||
print("╔" + "="*58 + "╗")
|
||
print("║" + " "*15 + "Anti-AI Detector 测试" + " "*20 + "║")
|
||
print("╚" + "="*58 + "╝")
|
||
print("\n")
|
||
|
||
test_chinese()
|
||
test_english()
|
||
test_xiaohongshu()
|
||
test_it_integration()
|
||
test_analysis()
|
||
|
||
print("="*60)
|
||
print("所有测试完成!")
|
||
print("="*60)
|
||
|
||
|
||
if __name__ == '__main__':
|
||
main()
|