#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import json
from pathlib import Path

# ===== 配置区域 =====
JSON_PATH = Path()  # 修改为你的json文件路径

def main():
    # 初始化计数字典
    counters = {f"[[{i}]]": 0 for i in range(1, 7)}

    # 读取 JSON 文件
    with open(JSON_PATH, "r", encoding="utf-8") as f:
        data = json.load(f)

    # 遍历数据并统计
    for item in data:
        wrong_type = item.get("wrong_types", None)
        if wrong_type in counters:
            counters[wrong_type] += 1

    # 计算总次数
    total = sum(counters.values())

    # 打印结果
    print("===== 统计结果 =====")
    for k, v in counters.items():
        percent = (v / total * 100) if total > 0 else 0
        print(f"{k} 出现次数: {v} | 占比: {percent:.2f}%")
    print(f"总次数: {total}")

if __name__ == "__main__":
    main()
