{ "cells": [ { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "第一单元 . 总题数: 2213 , 完成对应题数: 1401\n", "第二单元 . 总题数: 3472 , 完成对应题数: 2135\n", "第三单元 . 总题数: 2426 , 完成对应题数: 395\n", "第四单元 . 总题数: 1657 , 完成对应题数: 1037\n", "第五单元 . 总题数: 1590 , 完成对应题数: 307\n", "第六单元 . 总题数: 1555 , 完成对应题数: 431\n", "第七单元 . 总题数: 1996 , 完成对应题数: 958\n", "第八单元 . 总题数: 1526 , 完成对应题数: 525\n", "第九单元 . 总题数: 473 , 完成对应题数: 101\n", "暂无对应 . 总题数: 344 , 完成对应题数: 121\n", "题库总题数: 18795, 已有单元标签题数: 16941, 未赋单元标签题数: 1854.\n", "未赋标签的题号列表已保存至: 文本文件/题号筛选.txt\n" ] } ], "source": [ "import json,os\n", "\n", "filename = r\"文本文件/题号筛选.txt\"\n", "with open(r\"..\\题库0.3\\Problems.json\",\"r\",encoding = \"u8\") as f:\n", " database = f.read()\n", "pro_dict = json.loads(database)\n", "units = [\"第一单元\",\"第二单元\",\"第三单元\",\"第四单元\",\"第五单元\",\"第六单元\",\"第七单元\",\"第八单元\",\"第九单元\",\"暂无对应\"]\n", "count1 = [0]*10\n", "count2 = [0]*10\n", "count3 = 0\n", "untagged = []\n", "for id in pro_dict:\n", " for u in range(10):\n", " unit = units[u]\n", " if unit in \"\".join(pro_dict[id][\"tags\"]):\n", " count1[u] += 1\n", " if len(pro_dict[id][\"objs\"]) > 0:\n", " count2[u] += 1\n", " if len(pro_dict[id][\"tags\"]) == 0:\n", " count3 += 1\n", " untagged.append(id)\n", "for u in range(len(units)):\n", " print(units[u],\". 总题数:\",count1[u],\", 完成对应题数:\",count2[u])\n", "print(\"题库总题数: %d, 已有单元标签题数: %d, 未赋单元标签题数: %d.\"%(len(pro_dict),len(pro_dict)-count3,count3))\n", "with open (filename,\"w\",encoding = \"u8\") as f:\n", " f.write(\",\".join(untagged))\n", "print(\"未赋标签的题号列表已保存至: %s\" %(filename))\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "mathdept", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.15" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc" } } }, "nbformat": 4, "nbformat_minor": 2 }