全部评论 6

  • 啊,那个原文中的食用方法有点小问题,以下面这个玩意为主啊(主要还是看自己)

    一、前期准备

    1. 安装Python:官网(python.org)下载3.7+版本,安装时必须勾选「Add Python to PATH」,安装后用 python --version 验证。
    2. 创建工作文件夹:命名为 ai_code_detector ,放入两个文件——检测脚本(保存为 detector.py ,复制帖子中完整Python代码)、待检测C++文件(如 main.cpp )。
    3. 安装依赖库:打开命令行,切换到工作文件夹,运行 pip install nltk clang (补充帖子遗漏的clang依赖)。

    二、修改检测脚本

    在 detector.py 末尾添加以下代码(替换原测试代码):

    
    if __name__ == "__main__":
        detector = CppAIDetector()
        with open('main.cpp', 'r', encoding='utf-8') as f:
            cpp_code = f.read()
        results = detector.comprehensive_detect(cpp_code)
        print("\n" + "="*50)
        print("AI代码生成检测报告")
        print("="*50)
        print(f"AI生成概率: {results['ai_probability']}%")
        print(f"综合判断: {results['verdict']}")
        print(f"置信度: {results['confidence']}")
        if 'features' in results['details']:
            print("\n关键特征指标:")
            features = results['details']['features']
            print(f"  - 代码长度: {features.get('total_lines', 'N/A')} 行")
            print(f"  - 注释密度: {features.get('comment_density', 0):.3f}")
            print(f"  - 文本熵值: {features.get('entropy', 0):.3f}")
     
    

    三、运行与查看结果

    1. 命令行输入 python detector.py ,运行检测。
    2. 核心看「AI生成概率」:>70%高概率AI生成,<40%低概率人工编写,中间值需人工复核。

    帮我顶一下,ACGO没有置顶

    3天前 来自 湖北

    1
  • %%%,看不懂

    3天前 来自 江西

    1
  • 求了,谁帮我测试一下

    3天前 来自 湖北

    0
  • 我认为不行

    3天前 来自 浙江

    0
  • 不错,发现了我的代码全AI写的

    3天前 来自 浙江

    0
  • 有啥建议写在这里,作者会康到的

    2025-12-07 来自 湖北

    0

热门讨论