20230324 evening
This commit is contained in:
parent
6fa100c8d0
commit
fbe0012eef
|
|
@ -2,7 +2,7 @@
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 19,
|
"execution_count": 3,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
"0"
|
"0"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 19,
|
"execution_count": 3,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
"source": [
|
"source": [
|
||||||
"import os,re,json\n",
|
"import os,re,json\n",
|
||||||
"\"\"\"这里编辑题号(列表)后将在vscode中打开窗口, 编辑后保存关闭, 随后运行第二个代码块\"\"\"\n",
|
"\"\"\"这里编辑题号(列表)后将在vscode中打开窗口, 编辑后保存关闭, 随后运行第二个代码块\"\"\"\n",
|
||||||
"problems = \"31353\"\n",
|
"problems = \"13543,13685\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def generate_number_set(string,dict):\n",
|
"def generate_number_set(string,dict):\n",
|
||||||
" string = re.sub(r\"[\\n\\s]\",\"\",string)\n",
|
" string = re.sub(r\"[\\n\\s]\",\"\",string)\n",
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 18,
|
"execution_count": 2,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": 1,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
|
@ -11,11 +11,9 @@
|
||||||
"text": [
|
"text": [
|
||||||
"正在处理题块 1 .\n",
|
"正在处理题块 1 .\n",
|
||||||
"题块 1 处理完毕.\n",
|
"题块 1 处理完毕.\n",
|
||||||
"正在处理题块 2 .\n",
|
"开始编译教师版本pdf文件: 临时文件/第四讲_教师_20230324.tex\n",
|
||||||
"题块 2 处理完毕.\n",
|
|
||||||
"开始编译教师版本pdf文件: 临时文件/16_导数及其应用_教师_20230321.tex\n",
|
|
||||||
"0\n",
|
"0\n",
|
||||||
"开始编译学生版本pdf文件: 临时文件/16_导数及其应用_学生_20230321.tex\n",
|
"开始编译学生版本pdf文件: 临时文件/第四讲_学生_20230324.tex\n",
|
||||||
"0\n"
|
"0\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -28,12 +26,12 @@
|
||||||
"\"\"\"2: 测验卷与周末卷(填空题, 选择题, 解答题)\"\"\"\n",
|
"\"\"\"2: 测验卷与周末卷(填空题, 选择题, 解答题)\"\"\"\n",
|
||||||
"\"\"\"3: 日常选题讲义(一个section)\"\"\"\n",
|
"\"\"\"3: 日常选题讲义(一个section)\"\"\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"paper_type = 1 # 随后设置一下后续的讲义标题\n",
|
"paper_type = 3 # 随后设置一下后续的讲义标题\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\"\"\"---设置题块编号---\"\"\"\n",
|
"\"\"\"---设置题块编号---\"\"\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"problems = [\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",
|
"\n",
|
||||||
"\"\"\"---设置结束---\"\"\"\n",
|
"\"\"\"---设置结束---\"\"\"\n",
|
||||||
|
|
@ -52,7 +50,7 @@
|
||||||
"elif paper_type == 3:\n",
|
"elif paper_type == 3:\n",
|
||||||
" enumi_mode = 0 #设置模式(1为整卷统一编号, 0为每一部分从1开始编号)\n",
|
" enumi_mode = 0 #设置模式(1为整卷统一编号, 0为每一部分从1开始编号)\n",
|
||||||
" template_file = \"模板文件/日常选题讲义模板.txt\" #设置模板文件名\n",
|
" template_file = \"模板文件/日常选题讲义模板.txt\" #设置模板文件名\n",
|
||||||
" exec_list = [(\"标题文字待处理\",\"第三讲\")] #设置讲义标题\n",
|
" exec_list = [(\"标题文字待处理\",\"第四讲\")] #设置讲义标题\n",
|
||||||
" destination_file = \"临时文件/\"+exec_list[0][1] # 设置输出文件名\n",
|
" destination_file = \"临时文件/\"+exec_list[0][1] # 设置输出文件名\n",
|
||||||
" \n",
|
" \n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|
|
||||||
103
工具/试卷答案生成.ipynb
103
工具/试卷答案生成.ipynb
|
|
@ -2,13 +2,40 @@
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 10,
|
"execution_count": 11,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"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"
|
"0\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -16,39 +43,56 @@
|
||||||
"source": [
|
"source": [
|
||||||
"import os,re,json\n",
|
"import os,re,json\n",
|
||||||
"\n",
|
"\n",
|
||||||
"filename = r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\第二轮复习讲义\\09_立体几何综合.tex\"\n",
|
"# filename = r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\第二轮复习讲义\\09_立体几何综合.tex\"\n",
|
||||||
"outfilename = \"立体几何综合答案\"\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",
|
"pdf_dir = \"临时文件\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"with open(filename,\"r\",encoding = \"u8\") as f:\n",
|
"for filename in filelist:\n",
|
||||||
" data = f.read()\n",
|
" outfilename = os.path.split(filename)[1][:-4]+\"答案\"\n",
|
||||||
"with open(\"../题库0.3/Problems.json\",\"r\",encoding = \"u8\") as f:\n",
|
" print(\"正在生成: \",outfilename)\n",
|
||||||
" pro_dict = json.loads(f.read())\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",
|
"\n",
|
||||||
"ids = re.findall(r\"\\((\\d{6})\\)\",data)\n",
|
" ids = re.findall(r\"\\((\\d{6})\\)\",data)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"output_data = \"\"\n",
|
" output_data = \"\"\n",
|
||||||
"for id in ids:\n",
|
" for id in ids:\n",
|
||||||
" problemset = pro_dict[id]\n",
|
" problemset = pro_dict[id]\n",
|
||||||
" content = problemset[\"content\"]\n",
|
" content = problemset[\"content\"]\n",
|
||||||
" solution = problemset[\"solution\"]\n",
|
" solution = problemset[\"solution\"]\n",
|
||||||
" answer = \"\\\\textcolor{red}{\" + (problemset[\"ans\"] if problemset[\"ans\"] != \"\" else \"\\\\textcolor{blue}{暂无答案\") + \"}\"\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 += \"\\\\item \" + \"(\"+id+\") \" + content + \"\\n\\n\" + \"答案: \" + answer + \"\\n\\n\" \n",
|
||||||
"\n",
|
"\n",
|
||||||
"with open(\"模板文件/日常选题讲义模板.txt\",\"r\",encoding = \"u8\") as f:\n",
|
" with open(\"模板文件/日常选题讲义模板.txt\",\"r\",encoding = \"u8\") as f:\n",
|
||||||
" outlatex = f.read()\n",
|
" outlatex = f.read()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"outlatex = outlatex.replace(\"待替换1\",output_data)\n",
|
" outlatex = outlatex.replace(\"待替换1\",output_data)\n",
|
||||||
"outlatex = outlatex.replace(\"标题文字待处理\",outfilename)\n",
|
" outlatex = outlatex.replace(\"标题文字待处理\",outfilename)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"outfile = os.path.join(\"临时文件\",outfilename+\".tex\")\n",
|
" outfile = os.path.join(\"临时文件\",outfilename+\".tex\")\n",
|
||||||
"with open(outfile,\"w\",encoding=\"u8\") as f:\n",
|
" with open(outfile,\"w\",encoding=\"u8\") as f:\n",
|
||||||
" f.write(outlatex)\n",
|
" f.write(outlatex)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"outfile = outfile.replace(\"\\\\\",\"/\")\n",
|
" outfile = outfile.replace(\"\\\\\",\"/\")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"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",
|
" print(os.system(\"xelatex -interaction=batchmode -output-directory=\" + pdf_dir + \" \"+ outfile))\n",
|
||||||
"\n",
|
"\n",
|
||||||
" "
|
" "
|
||||||
]
|
]
|
||||||
|
|
@ -63,7 +107,7 @@
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "mathdept",
|
"display_name": "pythontest",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
|
@ -79,7 +123,12 @@
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.9.15"
|
"version": "3.9.15"
|
||||||
},
|
},
|
||||||
"orig_nbformat": 4
|
"orig_nbformat": 4,
|
||||||
|
"vscode": {
|
||||||
|
"interpreter": {
|
||||||
|
"hash": "91219a98e0e9be72efb992f647fe78b593124968b75db0b865552d6787c8db93"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
"nbformat_minor": 2
|
"nbformat_minor": 2
|
||||||
|
|
|
||||||
|
|
@ -337907,7 +337907,7 @@
|
||||||
},
|
},
|
||||||
"013663": {
|
"013663": {
|
||||||
"id": "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": [],
|
"objs": [],
|
||||||
"tags": [
|
"tags": [
|
||||||
"第四单元"
|
"第四单元"
|
||||||
|
|
|
||||||
Reference in New Issue