diff --git a/工具/修改题目数据库.ipynb b/工具/修改题目数据库.ipynb index 8ab9e352..5ea573ab 100644 --- a/工具/修改题目数据库.ipynb +++ b/工具/修改题目数据库.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 19, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -11,7 +11,7 @@ "0" ] }, - "execution_count": 19, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -19,7 +19,7 @@ "source": [ "import os,re,json\n", "\"\"\"这里编辑题号(列表)后将在vscode中打开窗口, 编辑后保存关闭, 随后运行第二个代码块\"\"\"\n", - "problems = \"31353\"\n", + "problems = \"13543,13685\"\n", "\n", "def generate_number_set(string,dict):\n", " string = re.sub(r\"[\\n\\s]\",\"\",string)\n", @@ -51,7 +51,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ diff --git a/工具/讲义生成.ipynb b/工具/讲义生成.ipynb index 507f8719..b0a41103 100644 --- a/工具/讲义生成.ipynb +++ b/工具/讲义生成.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -11,11 +11,9 @@ "text": [ "正在处理题块 1 .\n", "题块 1 处理完毕.\n", - "正在处理题块 2 .\n", - "题块 2 处理完毕.\n", - "开始编译教师版本pdf文件: 临时文件/16_导数及其应用_教师_20230321.tex\n", + "开始编译教师版本pdf文件: 临时文件/第四讲_教师_20230324.tex\n", "0\n", - "开始编译学生版本pdf文件: 临时文件/16_导数及其应用_学生_20230321.tex\n", + "开始编译学生版本pdf文件: 临时文件/第四讲_学生_20230324.tex\n", "0\n" ] } @@ -28,12 +26,12 @@ "\"\"\"2: 测验卷与周末卷(填空题, 选择题, 解答题)\"\"\"\n", "\"\"\"3: 日常选题讲义(一个section)\"\"\"\n", "\n", - "paper_type = 1 # 随后设置一下后续的讲义标题\n", + "paper_type = 3 # 随后设置一下后续的讲义标题\n", "\n", "\"\"\"---设置题块编号---\"\"\"\n", "\n", "problems = [\n", - "\"13297,13633,21376,21396,30400,40202,40205,31353,21428,21429,31354,30416,30424\",\"12612,12764,13334,13508,40222,21365,21395,21418,21431,31355,31356,30420,30426\"\n", + "\"003927,013323,013422,013413,003737,013487,013453,003749,013590,013637,013639,003813,003802,013329,013602,013663,013672,013625,003834,003939,013688\"\n", "]\n", "\n", "\"\"\"---设置结束---\"\"\"\n", @@ -52,7 +50,7 @@ "elif paper_type == 3:\n", " enumi_mode = 0 #设置模式(1为整卷统一编号, 0为每一部分从1开始编号)\n", " template_file = \"模板文件/日常选题讲义模板.txt\" #设置模板文件名\n", - " exec_list = [(\"标题文字待处理\",\"第三讲\")] #设置讲义标题\n", + " exec_list = [(\"标题文字待处理\",\"第四讲\")] #设置讲义标题\n", " destination_file = \"临时文件/\"+exec_list[0][1] # 设置输出文件名\n", " \n", "\n", diff --git a/工具/试卷答案生成.ipynb b/工具/试卷答案生成.ipynb index 3d7aab92..c61b5c01 100644 --- a/工具/试卷答案生成.ipynb +++ b/工具/试卷答案生成.ipynb @@ -2,13 +2,40 @@ "cells": [ { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "正在生成: 赋能17答案\n", + "0\n", + "正在生成: 赋能18答案\n", + "0\n", + "正在生成: 赋能19答案\n", + "0\n", + "正在生成: 赋能20答案\n", + "0\n", + "正在生成: 赋能21答案\n", + "0\n", + "正在生成: 赋能22答案\n", + "0\n", + "正在生成: 赋能23答案\n", + "0\n", + "正在生成: 赋能24答案\n", + "0\n", + "正在生成: 赋能25答案\n", + "0\n", + "正在生成: 赋能26答案\n", + "0\n", + "正在生成: 赋能27答案\n", + "0\n", + "正在生成: 赋能28答案\n", + "0\n", + "正在生成: 赋能29答案\n", + "0\n", + "正在生成: 赋能30答案\n", "0\n" ] } @@ -16,39 +43,56 @@ "source": [ "import os,re,json\n", "\n", - "filename = r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\第二轮复习讲义\\09_立体几何综合.tex\"\n", - "outfilename = \"立体几何综合答案\"\n", + "# filename = r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\第二轮复习讲义\\09_立体几何综合.tex\"\n", + "filelist = [r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能17.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能18.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能19.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能20.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能21.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能22.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能23.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能24.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能25.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能26.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能27.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能28.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能29.tex\",\n", + "r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\赋能\\赋能30.tex\"\n", + "]\n", "pdf_dir = \"临时文件\"\n", "\n", - "with open(filename,\"r\",encoding = \"u8\") as f:\n", - " data = f.read()\n", - "with open(\"../题库0.3/Problems.json\",\"r\",encoding = \"u8\") as f:\n", - " pro_dict = json.loads(f.read())\n", + "for filename in filelist:\n", + " outfilename = os.path.split(filename)[1][:-4]+\"答案\"\n", + " print(\"正在生成: \",outfilename)\n", + " with open(filename,\"r\",encoding = \"u8\") as f:\n", + " data = f.read()\n", + " with open(\"../题库0.3/Problems.json\",\"r\",encoding = \"u8\") as f:\n", + " pro_dict = json.loads(f.read())\n", "\n", - "ids = re.findall(r\"\\((\\d{6})\\)\",data)\n", + " ids = re.findall(r\"\\((\\d{6})\\)\",data)\n", "\n", - "output_data = \"\"\n", - "for id in ids:\n", - " problemset = pro_dict[id]\n", - " content = problemset[\"content\"]\n", - " solution = problemset[\"solution\"]\n", - " answer = \"\\\\textcolor{red}{\" + (problemset[\"ans\"] if problemset[\"ans\"] != \"\" else \"\\\\textcolor{blue}{暂无答案\") + \"}\"\n", - " output_data += \"\\\\item \" + \"(\"+id+\") \" + content + \"\\n\\n\" + \"答案: \" + answer + \"\\n\\n\" + (\"\" if solution == \"\" else (\"解答或提示: \" + solution)) + \"\\n\\n\"\n", + " output_data = \"\"\n", + " for id in ids:\n", + " problemset = pro_dict[id]\n", + " content = problemset[\"content\"]\n", + " solution = problemset[\"solution\"]\n", + " answer = \"\\\\textcolor{red}{\" + (problemset[\"ans\"] if problemset[\"ans\"] != \"\" else \"\\\\textcolor{blue}{暂无答案}\") + \"}\"\n", + " output_data += \"\\\\item \" + \"(\"+id+\") \" + content + \"\\n\\n\" + \"答案: \" + answer + \"\\n\\n\" \n", "\n", - "with open(\"模板文件/日常选题讲义模板.txt\",\"r\",encoding = \"u8\") as f:\n", - " outlatex = f.read()\n", + " with open(\"模板文件/日常选题讲义模板.txt\",\"r\",encoding = \"u8\") as f:\n", + " outlatex = f.read()\n", "\n", - "outlatex = outlatex.replace(\"待替换1\",output_data)\n", - "outlatex = outlatex.replace(\"标题文字待处理\",outfilename)\n", + " outlatex = outlatex.replace(\"待替换1\",output_data)\n", + " outlatex = outlatex.replace(\"标题文字待处理\",outfilename)\n", "\n", - "outfile = os.path.join(\"临时文件\",outfilename+\".tex\")\n", - "with open(outfile,\"w\",encoding=\"u8\") as f:\n", - " f.write(outlatex)\n", + " outfile = os.path.join(\"临时文件\",outfilename+\".tex\")\n", + " with open(outfile,\"w\",encoding=\"u8\") as f:\n", + " f.write(outlatex)\n", "\n", - "outfile = outfile.replace(\"\\\\\",\"/\")\n", + " outfile = outfile.replace(\"\\\\\",\"/\")\n", "\n", - "os.system(\"xelatex -interaction=batchmode -output-directory=\" + pdf_dir + \" \"+ outfile)\n", - "print(os.system(\"xelatex -interaction=batchmode -output-directory=\" + pdf_dir + \" \"+ outfile))\n", + " os.system(\"xelatex -interaction=batchmode -output-directory=\" + pdf_dir + \" \"+ outfile)\n", + " print(os.system(\"xelatex -interaction=batchmode -output-directory=\" + pdf_dir + \" \"+ outfile))\n", "\n", " " ] @@ -63,7 +107,7 @@ ], "metadata": { "kernelspec": { - "display_name": "mathdept", + "display_name": "pythontest", "language": "python", "name": "python3" }, @@ -79,7 +123,12 @@ "pygments_lexer": "ipython3", "version": "3.9.15" }, - "orig_nbformat": 4 + "orig_nbformat": 4, + "vscode": { + "interpreter": { + "hash": "91219a98e0e9be72efb992f647fe78b593124968b75db0b865552d6787c8db93" + } + } }, "nbformat": 4, "nbformat_minor": 2 diff --git a/题库0.3/Problems.json b/题库0.3/Problems.json index ce7ac5c4..1978fa71 100644 --- a/题库0.3/Problems.json +++ b/题库0.3/Problems.json @@ -337907,7 +337907,7 @@ }, "013663": { "id": "013663", - "content": "设$\\{a_n\\}$是首项为正数的等比数列, 公比为$q$, 则``$q<0$''是''对任意的正整数$n$, $a_{2 n-1}+a_{2 n}<0$''的\\bracket{20}.\n\\twoch{充分非必要条件}{必要非充分条件}{充要条件}{既非充分又非必要条件}1", + "content": "设$\\{a_n\\}$是首项为正数的等比数列, 公比为$q$, 则``$q<0$''是''对任意的正整数$n$, $a_{2 n-1}+a_{2 n}<0$''的\\bracket{20}.\n\\twoch{充分非必要条件}{必要非充分条件}{充要条件}{既非充分又非必要条件}", "objs": [], "tags": [ "第四单元"