20230203 afternoon
This commit is contained in:
parent
6e7e691d15
commit
c21ebdcd45
|
|
@ -19,7 +19,7 @@
|
||||||
"source": [
|
"source": [
|
||||||
"import os,re,json\n",
|
"import os,re,json\n",
|
||||||
"\"\"\"这里编辑题号(列表)后将在vscode中打开窗口, 编辑后保存关闭, 随后运行第二个代码块\"\"\"\n",
|
"\"\"\"这里编辑题号(列表)后将在vscode中打开窗口, 编辑后保存关闭, 随后运行第二个代码块\"\"\"\n",
|
||||||
"problems = \"21106\"\n",
|
"problems = \"14384\"\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": 9,
|
"execution_count": 25,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,16 @@
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": 3,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"首个空闲id: 14103 , 直至 020000\n",
|
"首个空闲id: 14379 , 直至 020000\n",
|
||||||
"首个空闲id: 21441 , 直至 030000\n",
|
"首个空闲id: 21441 , 直至 030000\n",
|
||||||
"首个空闲id: 31206 , 直至 999999\n"
|
"首个空闲id: 31222 , 直至 999999\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "mathdept",
|
"display_name": "base",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
|
@ -59,12 +59,12 @@
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.8.15"
|
"version": "3.9.13"
|
||||||
},
|
},
|
||||||
"orig_nbformat": 4,
|
"orig_nbformat": 4,
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "42dd566da87765ddbe9b5c5b483063747fec4aacc5469ad554706e4b742e67b2"
|
"hash": "ad2bdc8ecc057115af97d19610ffacc2b4e99fae6737bb82f5d7fb13d2f2c186"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
12781:12822,13692:13758,14103:14165
|
13008:13033,13034:13055,13147:13172,13196:13216,13845:13859,13860:13874,13875:13887,13888:13898,13899:13910,13911:13917,14204:14223,14224:14243,14244:14266,14267:14287,14325:14342,14379:14399
|
||||||
|
|
@ -2,15 +2,15 @@
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 15,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"import os,re,json,time\n",
|
"import os,re,json,time\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\"\"\"---设置原题目id与新题目id---\"\"\"\n",
|
"\"\"\"---设置原题目id与新题目id---\"\"\"\n",
|
||||||
"old_id = \"12281\"\n",
|
"old_id = \"3648\"\n",
|
||||||
"new_id = \"30505\"\n",
|
"new_id = \"31221\"\n",
|
||||||
"\"\"\"---设置完毕---\"\"\"\n",
|
"\"\"\"---设置完毕---\"\"\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"old_id = old_id.zfill(6)\n",
|
"old_id = old_id.zfill(6)\n",
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.8.15 ('mathdept')",
|
"display_name": "mathdept",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
|
@ -64,12 +64,12 @@
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.8.15"
|
"version": "3.9.15"
|
||||||
},
|
},
|
||||||
"orig_nbformat": 4,
|
"orig_nbformat": 4,
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "42dd566da87765ddbe9b5c5b483063747fec4aacc5469ad554706e4b742e67b2"
|
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,51 @@
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": 3,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"#修改起始id,出处,文件名\n",
|
"#修改起始id,出处,文件名\n",
|
||||||
"starting_id = 14103\n",
|
"starting_id = 14379\n",
|
||||||
"origin = \"2023年空中课堂高三复习题\"\n",
|
"raworigin = \"2023年空中课堂高三复习题\"\n",
|
||||||
"filename = r\"D:\\temp\\空中课堂2023.tex\"\n",
|
"filename = r\"D:\\temp\\空中课堂第三批.tex\"\n",
|
||||||
"editor = \"20230131\\t王伟叶\"\n",
|
"editor = \"20230203\\t王伟叶\"\n",
|
||||||
"indexed = False\n"
|
"indexed = False\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": 4,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"添加题号014379, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014380, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014381, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014382, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014383, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014384, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014385, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014386, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014387, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014388, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014389, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014390, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014391, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014392, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014393, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014394, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014395, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014396, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014397, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014398, 来源: 2023年空中课堂高三复习题13\n",
|
||||||
|
"添加题号014399, 来源: 2023年空中课堂高三复习题13\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import os,re,json\n",
|
"import os,re,json\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|
@ -84,9 +112,11 @@
|
||||||
" if pid in pro_dict:\n",
|
" if pid in pro_dict:\n",
|
||||||
" duplicate_flag = True\n",
|
" duplicate_flag = True\n",
|
||||||
" if indexed == False:\n",
|
" if indexed == False:\n",
|
||||||
" NewProblem = CreateNewProblem(id = pid, content = p, origin = origin + suffix , dict = pro_dict,editor = editor)\n",
|
" origin = raworigin + suffix\n",
|
||||||
" else:\n",
|
" else:\n",
|
||||||
" NewProblem = CreateNewProblem(id = pid, content = p, origin = origin + suffix + \"试题\" + str(id- starting_id+1), dict = pro_dict,editor = editor)\n",
|
" origin = raworigin + suffix + \"试题\" + str(id- starting_id+1)\n",
|
||||||
|
" NewProblem = CreateNewProblem(id = pid, content = p, origin = origin, dict = pro_dict,editor = editor)\n",
|
||||||
|
" print(\"添加题号\"+pid+\", \"+\"来源: \" + origin)\n",
|
||||||
" pro_dict[pid] = NewProblem\n",
|
" pro_dict[pid] = NewProblem\n",
|
||||||
" id += 1\n",
|
" id += 1\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|
@ -106,6 +136,26 @@
|
||||||
" print(\"题号有重复, 请检查.\\n\"*5)"
|
" print(\"题号有重复, 请检查.\\n\"*5)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"'18'"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 5,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"suffix"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
|
|
@ -130,12 +180,12 @@
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.8.15"
|
"version": "3.9.15"
|
||||||
},
|
},
|
||||||
"orig_nbformat": 4,
|
"orig_nbformat": 4,
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "42dd566da87765ddbe9b5c5b483063747fec4aacc5469ad554706e4b742e67b2"
|
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": 1,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
|
@ -189,7 +189,7 @@
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "pythontest",
|
"display_name": "mathdept",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
|
@ -208,7 +208,7 @@
|
||||||
"orig_nbformat": 4,
|
"orig_nbformat": 4,
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "91219a98e0e9be72efb992f647fe78b593124968b75db0b865552d6787c8db93"
|
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": 2,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
|
@ -15,9 +15,9 @@
|
||||||
"题块 2 处理完毕.\n",
|
"题块 2 处理完毕.\n",
|
||||||
"正在处理题块 3 .\n",
|
"正在处理题块 3 .\n",
|
||||||
"题块 3 处理完毕.\n",
|
"题块 3 处理完毕.\n",
|
||||||
"开始编译教师版本pdf文件: 临时文件/2023届静安区一模_教师_20230113.tex\n",
|
"开始编译教师版本pdf文件: 临时文件/寒假作业反馈练习_教师_20230202.tex\n",
|
||||||
"0\n",
|
"1\n",
|
||||||
"开始编译学生版本pdf文件: 临时文件/2023届静安区一模_学生_20230113.tex\n",
|
"开始编译学生版本pdf文件: 临时文件/寒假作业反馈练习_学生_20230202.tex\n",
|
||||||
"0\n"
|
"0\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
"# enumi_mode = 0\n",
|
"# enumi_mode = 0\n",
|
||||||
"\n",
|
"\n",
|
||||||
"#2023届测验卷与周末卷\n",
|
"#2023届测验卷与周末卷\n",
|
||||||
"exec_list = [(\"标题替换\",\"2023届静安区一模\")]\n",
|
"exec_list = [(\"标题替换\",\"寒假作业反馈练习\")]\n",
|
||||||
"enumi_mode = 1\n",
|
"enumi_mode = 1\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# 日常选题讲义\n",
|
"# 日常选题讲义\n",
|
||||||
|
|
@ -51,13 +51,13 @@
|
||||||
"\"\"\"---其他预处理替换命令结束---\"\"\"\n",
|
"\"\"\"---其他预处理替换命令结束---\"\"\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\"\"\"---设置目标文件名---\"\"\"\n",
|
"\"\"\"---设置目标文件名---\"\"\"\n",
|
||||||
"destination_file = \"临时文件/2023届静安区一模\"\n",
|
"destination_file = \"临时文件/寒假作业反馈练习\"\n",
|
||||||
"\"\"\"---设置目标文件名结束---\"\"\"\n",
|
"\"\"\"---设置目标文件名结束---\"\"\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\"\"\"---设置题号数据---\"\"\"\n",
|
"\"\"\"---设置题号数据---\"\"\"\n",
|
||||||
"problems = [\n",
|
"problems = [\n",
|
||||||
"\"12760:12771\",\"12772:12775\",\"12776:12780\"\n",
|
"\"31206:31215\",\"31216:31218\",\"31219:31221\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"]\n",
|
"]\n",
|
||||||
|
|
@ -210,7 +210,7 @@
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.9.15 ('pythontest')",
|
"display_name": "mathdept",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
|
@ -229,7 +229,7 @@
|
||||||
"orig_nbformat": 4,
|
"orig_nbformat": 4,
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "91219a98e0e9be72efb992f647fe78b593124968b75db0b865552d6787c8db93"
|
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,303 @@
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"031205 填空题\n"
|
"014103 填空题\n",
|
||||||
|
"014104 填空题\n",
|
||||||
|
"014105 填空题\n",
|
||||||
|
"014106 选择题\n",
|
||||||
|
"014107 填空题\n",
|
||||||
|
"014108 解答题\n",
|
||||||
|
"014109 解答题\n",
|
||||||
|
"014110 解答题\n",
|
||||||
|
"014111 填空题\n",
|
||||||
|
"014112 填空题\n",
|
||||||
|
"014113 解答题\n",
|
||||||
|
"014114 解答题\n",
|
||||||
|
"014115 填空题\n",
|
||||||
|
"014116 填空题\n",
|
||||||
|
"014117 填空题\n",
|
||||||
|
"014118 解答题\n",
|
||||||
|
"014119 解答题\n",
|
||||||
|
"014120 解答题\n",
|
||||||
|
"014121 解答题\n",
|
||||||
|
"014122 选择题\n",
|
||||||
|
"014123 填空题\n",
|
||||||
|
"014124 填空题\n",
|
||||||
|
"014125 填空题\n",
|
||||||
|
"014126 填空题\n",
|
||||||
|
"014127 填空题\n",
|
||||||
|
"014128 解答题\n",
|
||||||
|
"014129 解答题\n",
|
||||||
|
"014130 解答题\n",
|
||||||
|
"014131 解答题\n",
|
||||||
|
"014132 解答题\n",
|
||||||
|
"014133 填空题\n",
|
||||||
|
"014134 填空题\n",
|
||||||
|
"014135 填空题\n",
|
||||||
|
"014136 填空题\n",
|
||||||
|
"014137 选择题\n",
|
||||||
|
"014138 填空题\n",
|
||||||
|
"014139 填空题\n",
|
||||||
|
"014140 填空题\n",
|
||||||
|
"014141 填空题\n",
|
||||||
|
"014142 填空题\n",
|
||||||
|
"014143 填空题\n",
|
||||||
|
"014144 解答题\n",
|
||||||
|
"014145 选择题\n",
|
||||||
|
"014146 填空题\n",
|
||||||
|
"014147 填空题\n",
|
||||||
|
"014148 填空题\n",
|
||||||
|
"014149 填空题\n",
|
||||||
|
"014150 填空题\n",
|
||||||
|
"014151 解答题\n",
|
||||||
|
"014152 解答题\n",
|
||||||
|
"014153 解答题\n",
|
||||||
|
"014154 选择题\n",
|
||||||
|
"014155 填空题\n",
|
||||||
|
"014156 填空题\n",
|
||||||
|
"014157 填空题\n",
|
||||||
|
"014158 选择题\n",
|
||||||
|
"014159 选择题\n",
|
||||||
|
"014160 填空题\n",
|
||||||
|
"014161 填空题\n",
|
||||||
|
"014162 解答题\n",
|
||||||
|
"014163 解答题\n",
|
||||||
|
"014164 选择题\n",
|
||||||
|
"014165 解答题\n",
|
||||||
|
"014166 填空题\n",
|
||||||
|
"014167 填空题\n",
|
||||||
|
"014168 填空题\n",
|
||||||
|
"014169 选择题\n",
|
||||||
|
"014170 解答题\n",
|
||||||
|
"014171 解答题\n",
|
||||||
|
"014172 解答题\n",
|
||||||
|
"014173 解答题\n",
|
||||||
|
"014174 填空题\n",
|
||||||
|
"014175 填空题\n",
|
||||||
|
"014176 填空题\n",
|
||||||
|
"014177 填空题\n",
|
||||||
|
"014178 填空题\n",
|
||||||
|
"014179 填空题\n",
|
||||||
|
"014180 填空题\n",
|
||||||
|
"014181 选择题\n",
|
||||||
|
"014182 解答题\n",
|
||||||
|
"014183 填空题\n",
|
||||||
|
"014184 解答题\n",
|
||||||
|
"014185 选择题\n",
|
||||||
|
"014186 选择题\n",
|
||||||
|
"014187 填空题\n",
|
||||||
|
"014188 填空题\n",
|
||||||
|
"014189 填空题\n",
|
||||||
|
"014190 解答题\n",
|
||||||
|
"014191 解答题\n",
|
||||||
|
"014192 解答题\n",
|
||||||
|
"014193 填空题\n",
|
||||||
|
"014194 填空题\n",
|
||||||
|
"014195 填空题\n",
|
||||||
|
"014196 选择题\n",
|
||||||
|
"014197 选择题\n",
|
||||||
|
"014198 填空题\n",
|
||||||
|
"014199 填空题\n",
|
||||||
|
"014200 解答题\n",
|
||||||
|
"014201 解答题\n",
|
||||||
|
"014202 选择题\n",
|
||||||
|
"014203 解答题\n",
|
||||||
|
"014204 填空题\n",
|
||||||
|
"014205 填空题\n",
|
||||||
|
"014206 填空题\n",
|
||||||
|
"014207 填空题\n",
|
||||||
|
"014208 填空题\n",
|
||||||
|
"014209 解答题\n",
|
||||||
|
"014210 解答题\n",
|
||||||
|
"014211 解答题\n",
|
||||||
|
"014212 解答题\n",
|
||||||
|
"014213 选择题\n",
|
||||||
|
"014214 填空题\n",
|
||||||
|
"014215 填空题\n",
|
||||||
|
"014216 填空题\n",
|
||||||
|
"014217 填空题\n",
|
||||||
|
"014218 填空题\n",
|
||||||
|
"014219 填空题\n",
|
||||||
|
"014220 解答题\n",
|
||||||
|
"014221 解答题\n",
|
||||||
|
"014222 解答题\n",
|
||||||
|
"014223 解答题\n",
|
||||||
|
"014224 填空题\n",
|
||||||
|
"014225 填空题\n",
|
||||||
|
"014226 填空题\n",
|
||||||
|
"014227 填空题\n",
|
||||||
|
"014228 选择题\n",
|
||||||
|
"014229 解答题\n",
|
||||||
|
"014230 填空题\n",
|
||||||
|
"014231 解答题\n",
|
||||||
|
"014232 填空题\n",
|
||||||
|
"014233 填空题\n",
|
||||||
|
"014234 选择题\n",
|
||||||
|
"014235 解答题\n",
|
||||||
|
"014236 填空题\n",
|
||||||
|
"014237 填空题\n",
|
||||||
|
"014238 解答题\n",
|
||||||
|
"014239 解答题\n",
|
||||||
|
"014240 解答题\n",
|
||||||
|
"014241 解答题\n",
|
||||||
|
"014242 选择题\n",
|
||||||
|
"014243 解答题\n",
|
||||||
|
"014244 填空题\n",
|
||||||
|
"014245 填空题\n",
|
||||||
|
"014246 填空题\n",
|
||||||
|
"014247 选择题\n",
|
||||||
|
"014248 填空题\n",
|
||||||
|
"014249 解答题\n",
|
||||||
|
"014250 解答题\n",
|
||||||
|
"014251 解答题\n",
|
||||||
|
"014252 解答题\n",
|
||||||
|
"014253 解答题\n",
|
||||||
|
"014254 选择题\n",
|
||||||
|
"014255 填空题\n",
|
||||||
|
"014256 填空题\n",
|
||||||
|
"014257 选择题\n",
|
||||||
|
"014258 解答题\n",
|
||||||
|
"014259 填空题\n",
|
||||||
|
"014260 填空题\n",
|
||||||
|
"014261 填空题\n",
|
||||||
|
"014262 选择题\n",
|
||||||
|
"014263 填空题\n",
|
||||||
|
"014264 解答题\n",
|
||||||
|
"014265 填空题\n",
|
||||||
|
"014266 解答题\n",
|
||||||
|
"014267 填空题\n",
|
||||||
|
"014268 填空题\n",
|
||||||
|
"014269 填空题\n",
|
||||||
|
"014270 选择题\n",
|
||||||
|
"014271 填空题\n",
|
||||||
|
"014272 解答题\n",
|
||||||
|
"014273 解答题\n",
|
||||||
|
"014274 解答题\n",
|
||||||
|
"014275 解答题\n",
|
||||||
|
"014276 填空题\n",
|
||||||
|
"014277 填空题\n",
|
||||||
|
"014278 填空题\n",
|
||||||
|
"014279 解答题\n",
|
||||||
|
"014280 填空题\n",
|
||||||
|
"014281 填空题\n",
|
||||||
|
"014282 填空题\n",
|
||||||
|
"014283 填空题\n",
|
||||||
|
"014284 解答题\n",
|
||||||
|
"014285 解答题\n",
|
||||||
|
"014286 填空题\n",
|
||||||
|
"014287 解答题\n",
|
||||||
|
"014288 填空题\n",
|
||||||
|
"014289 选择题\n",
|
||||||
|
"014290 填空题\n",
|
||||||
|
"014291 解答题\n",
|
||||||
|
"014292 填空题\n",
|
||||||
|
"014293 解答题\n",
|
||||||
|
"014294 解答题\n",
|
||||||
|
"014295 填空题\n",
|
||||||
|
"014296 填空题\n",
|
||||||
|
"014297 填空题\n",
|
||||||
|
"014298 选择题\n",
|
||||||
|
"014299 填空题\n",
|
||||||
|
"014300 填空题\n",
|
||||||
|
"014301 填空题\n",
|
||||||
|
"014302 填空题\n",
|
||||||
|
"014303 填空题\n",
|
||||||
|
"014304 解答题\n",
|
||||||
|
"014305 解答题\n",
|
||||||
|
"014306 解答题\n",
|
||||||
|
"014307 填空题\n",
|
||||||
|
"014308 填空题\n",
|
||||||
|
"014309 填空题\n",
|
||||||
|
"014310 填空题\n",
|
||||||
|
"014311 填空题\n",
|
||||||
|
"014312 填空题\n",
|
||||||
|
"014313 解答题\n",
|
||||||
|
"014314 填空题\n",
|
||||||
|
"014315 填空题\n",
|
||||||
|
"014316 填空题\n",
|
||||||
|
"014317 填空题\n",
|
||||||
|
"014318 填空题\n",
|
||||||
|
"014319 填空题\n",
|
||||||
|
"014320 解答题\n",
|
||||||
|
"014321 填空题\n",
|
||||||
|
"014322 填空题\n",
|
||||||
|
"014323 解答题\n",
|
||||||
|
"014324 选择题\n",
|
||||||
|
"014325 选择题\n",
|
||||||
|
"014326 填空题\n",
|
||||||
|
"014327 填空题\n",
|
||||||
|
"014328 选择题\n",
|
||||||
|
"014329 解答题\n",
|
||||||
|
"014330 解答题\n",
|
||||||
|
"014331 解答题\n",
|
||||||
|
"014332 选择题\n",
|
||||||
|
"014333 解答题\n",
|
||||||
|
"014334 填空题\n",
|
||||||
|
"014335 填空题\n",
|
||||||
|
"014336 填空题\n",
|
||||||
|
"014337 解答题\n",
|
||||||
|
"014338 解答题\n",
|
||||||
|
"014339 填空题\n",
|
||||||
|
"014340 解答题\n",
|
||||||
|
"014341 填空题\n",
|
||||||
|
"014342 解答题\n",
|
||||||
|
"014343 选择题\n",
|
||||||
|
"014344 填空题\n",
|
||||||
|
"014345 填空题\n",
|
||||||
|
"014346 填空题\n",
|
||||||
|
"014347 解答题\n",
|
||||||
|
"014348 解答题\n",
|
||||||
|
"014349 解答题\n",
|
||||||
|
"014350 填空题\n",
|
||||||
|
"014351 选择题\n",
|
||||||
|
"014352 选择题\n",
|
||||||
|
"014353 填空题\n",
|
||||||
|
"014354 填空题\n",
|
||||||
|
"014355 填空题\n",
|
||||||
|
"014356 解答题\n",
|
||||||
|
"014357 解答题\n",
|
||||||
|
"014358 解答题\n",
|
||||||
|
"014359 填空题\n",
|
||||||
|
"014360 解答题\n",
|
||||||
|
"014361 填空题\n",
|
||||||
|
"014362 填空题\n",
|
||||||
|
"014363 填空题\n",
|
||||||
|
"014364 解答题\n",
|
||||||
|
"014365 解答题\n",
|
||||||
|
"014366 解答题\n",
|
||||||
|
"014367 填空题\n",
|
||||||
|
"014368 填空题\n",
|
||||||
|
"014369 填空题\n",
|
||||||
|
"014370 选择题\n",
|
||||||
|
"014371 填空题\n",
|
||||||
|
"014372 填空题\n",
|
||||||
|
"014373 填空题\n",
|
||||||
|
"014374 填空题\n",
|
||||||
|
"014375 填空题\n",
|
||||||
|
"014376 解答题\n",
|
||||||
|
"014377 填空题\n",
|
||||||
|
"014378 解答题\n",
|
||||||
|
"014379 填空题\n",
|
||||||
|
"014380 填空题\n",
|
||||||
|
"014381 填空题\n",
|
||||||
|
"014382 填空题\n",
|
||||||
|
"014383 填空题\n",
|
||||||
|
"014384 解答题\n",
|
||||||
|
"014385 解答题\n",
|
||||||
|
"014386 解答题\n",
|
||||||
|
"014387 解答题\n",
|
||||||
|
"014388 填空题\n",
|
||||||
|
"014389 填空题\n",
|
||||||
|
"014390 解答题\n",
|
||||||
|
"014391 解答题\n",
|
||||||
|
"014392 填空题\n",
|
||||||
|
"014393 填空题\n",
|
||||||
|
"014394 填空题\n",
|
||||||
|
"014395 解答题\n",
|
||||||
|
"014396 解答题\n",
|
||||||
|
"014397 解答题\n",
|
||||||
|
"014398 解答题\n",
|
||||||
|
"014399 解答题\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -51,7 +347,7 @@
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "pythontest",
|
"display_name": "mathdept",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
|
@ -70,7 +366,7 @@
|
||||||
"orig_nbformat": 4,
|
"orig_nbformat": 4,
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "91219a98e0e9be72efb992f647fe78b593124968b75db0b865552d6787c8db93"
|
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"开始编译教师版本pdf文件: 临时文件/01_集合逻辑不等式备选_教师用_20230201.tex\n",
|
"开始编译教师版本pdf文件: 临时文件/03_三角平面向量复数备选_教师用_20230203.tex\n",
|
||||||
"0\n",
|
"0\n",
|
||||||
"开始编译学生版本pdf文件: 临时文件/01_集合逻辑不等式备选_学生用_20230201.tex\n",
|
"开始编译学生版本pdf文件: 临时文件/03_三角平面向量复数备选_学生用_20230203.tex\n",
|
||||||
"0\n"
|
"0\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
"\n",
|
"\n",
|
||||||
"\"\"\"---设置文件名---\"\"\"\n",
|
"\"\"\"---设置文件名---\"\"\"\n",
|
||||||
"#目录和文件的分隔务必用/\n",
|
"#目录和文件的分隔务必用/\n",
|
||||||
"filename = \"临时文件/01_集合逻辑不等式备选\"\n",
|
"filename = \"临时文件/03_三角平面向量复数备选\"\n",
|
||||||
"\"\"\"---设置文件名结束---\"\"\"\n",
|
"\"\"\"---设置文件名结束---\"\"\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|
@ -188,7 +188,7 @@
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.9.15 (main, Nov 24 2022, 14:39:17) [MSC v.1916 64 bit (AMD64)]"
|
"version": "3.9.15"
|
||||||
},
|
},
|
||||||
"orig_nbformat": 4,
|
"orig_nbformat": 4,
|
||||||
"vscode": {
|
"vscode": {
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "pythontest",
|
"display_name": "mathdept",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
"orig_nbformat": 4,
|
"orig_nbformat": 4,
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "91219a98e0e9be72efb992f647fe78b593124968b75db0b865552d6787c8db93"
|
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -522,7 +522,7 @@
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.9.15 ('pythontest')",
|
"display_name": "mathdept",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
|
@ -536,12 +536,12 @@
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.9.15"
|
"version": "3.9.15 (main, Nov 24 2022, 14:39:17) [MSC v.1916 64 bit (AMD64)]"
|
||||||
},
|
},
|
||||||
"orig_nbformat": 4,
|
"orig_nbformat": 4,
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "91219a98e0e9be72efb992f647fe78b593124968b75db0b865552d6787c8db93"
|
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,428 @@
|
||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 2,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import os,re\n",
|
||||||
|
"import win32clipboard as wc\n",
|
||||||
|
"import win32con\n",
|
||||||
|
"\n",
|
||||||
|
"# 获取剪切板内容\n",
|
||||||
|
"def getCopy():\n",
|
||||||
|
" wc.OpenClipboard()\n",
|
||||||
|
" t = wc.GetClipboardData(win32con.CF_UNICODETEXT)\n",
|
||||||
|
" wc.CloseClipboard()\n",
|
||||||
|
" return t\n",
|
||||||
|
"\n",
|
||||||
|
"# 写入剪切板内容\n",
|
||||||
|
"def setCopy(str):\n",
|
||||||
|
" wc.OpenClipboard()\n",
|
||||||
|
" wc.EmptyClipboard()\n",
|
||||||
|
" wc.SetClipboardData(win32con.CF_UNICODETEXT, str)\n",
|
||||||
|
" wc.CloseClipboard()\n",
|
||||||
|
"\n",
|
||||||
|
"def full_stop(matchobj):\n",
|
||||||
|
" if matchobj.group(1) == \"。\" or matchobj.group(1) == \".\":\n",
|
||||||
|
" return \". \"\n",
|
||||||
|
" else:\n",
|
||||||
|
" return \".\\n\"\n",
|
||||||
|
"def refine_brackets(matchobj):\n",
|
||||||
|
" return matchobj.group(1)[1:-1]\n",
|
||||||
|
"def insert_a_blank(matchobj):\n",
|
||||||
|
" return matchobj.group(1)[:-1]+\" \"+matchobj.group(1)[-1]\n",
|
||||||
|
"def multiple_choice(matchobj):\n",
|
||||||
|
" string = \"\\\\fourch\" + \"{\" + matchobj.group(1) + \"}{\" + matchobj.group(2) + \"}{\" + matchobj.group(3) + \"}{\" + matchobj.group(4) + \"}\\n\"\n",
|
||||||
|
" return string\n",
|
||||||
|
"def boldsymbols(matchobj):\n",
|
||||||
|
" return \"\\\\i\"+matchobj.group(1)[:-1]+\"\\\\mathbf{\"+matchobj.group(1)[-1]+\"}\"\n",
|
||||||
|
"def boldsymbols_star(matchobj):\n",
|
||||||
|
" return \"\\\\in \\\\mathbf{\"+matchobj.group(1)+\"}^*\"\n",
|
||||||
|
"def singleboldsymbols(matchobj):\n",
|
||||||
|
" return \"$\\\\mathbf{\" + matchobj.group(1) + \"}$\"\n",
|
||||||
|
"def blackboardbold(matchobj):\n",
|
||||||
|
" string = \"\\\\mathbf\" + \"{\" + matchobj.group(1) + \"}\"\n",
|
||||||
|
" return string\n",
|
||||||
|
"def limit(matchobj):\n",
|
||||||
|
" return \"\\\\displaystyle\\\\lim_{\"+matchobj.group(1)+\"}\"\n",
|
||||||
|
"def replace_i(matchobj):\n",
|
||||||
|
" string = matchobj.group(1)\n",
|
||||||
|
" length = len(string)\n",
|
||||||
|
" for i in range(length-1,-1,-1):\n",
|
||||||
|
" if string[i] == \"i\" and not \"item\" in string[i:] and not \"overline\" in string[i:]:\n",
|
||||||
|
" string = string[:i] + \"\\\\mathrm{i}\" + string[i+1:]\n",
|
||||||
|
" return string\n",
|
||||||
|
"def refine_log(matchobj):\n",
|
||||||
|
" return r\"\\log_\"+matchobj.group(1)\n",
|
||||||
|
"def refine_powers(matchobj):\n",
|
||||||
|
" base = matchobj.group(1)\n",
|
||||||
|
" power = matchobj.group(2)\n",
|
||||||
|
" return base + \"^\" + power\n",
|
||||||
|
"def refine_sequences(matchobj):\n",
|
||||||
|
" return \"\\{\" + matchobj.group(1) + \"\\}\"\n",
|
||||||
|
"def refine_starting_brackets(matchobj):\n",
|
||||||
|
" return \"$\" + matchobj.group(1)\n",
|
||||||
|
"def refine_left_operating_brackets(matchobj):\n",
|
||||||
|
" obj = matchobj.group(2)\n",
|
||||||
|
" return matchobj.group(1)+obj\n",
|
||||||
|
"def refine_right_operating_brackets(matchobj):\n",
|
||||||
|
" obj = matchobj.group(1)\n",
|
||||||
|
" return obj + matchobj.group(2)\n",
|
||||||
|
"def refine_brackets_in_brackets(matchobj):\n",
|
||||||
|
" return matchobj.group(1) + matchobj.group(2) + matchobj.group(3)\n",
|
||||||
|
"def mathbf(matchobj):\n",
|
||||||
|
" return \"\\\\mathbf{\" + matchobj.group(1) + \"}^\" + matchobj.group(2)\n",
|
||||||
|
"#以上是202207之前的文本处理机制\n",
|
||||||
|
"global layer\n",
|
||||||
|
"def rename_bracket(matchobj):\n",
|
||||||
|
" return \"leftbracket\" + str(layer) + matchobj.group(1) + \"rightbracket\" + str(layer)\n",
|
||||||
|
"def frac_brackets(matchobj):\n",
|
||||||
|
" return \"frac{\"+matchobj.group(1)+\"}{\"+matchobj.group(2)+\"}\"\n",
|
||||||
|
"def frac_single_second_bracket(matchobj):\n",
|
||||||
|
" return \"frac \"+matchobj.group(1)+\"{\"+matchobj.group(2)+\"}\"\n",
|
||||||
|
"def recall_vital_bracket(matchobj):\n",
|
||||||
|
" return matchobj.group(1) + \"{\" + matchobj.group(2) + \"}\"\n",
|
||||||
|
"def sqrt_brackets(matchobj):\n",
|
||||||
|
" if matchobj.group(1) == None:\n",
|
||||||
|
" first_group = \"\"\n",
|
||||||
|
" else:\n",
|
||||||
|
" first_group = matchobj.group(1)\n",
|
||||||
|
" return \"sqrt \"+ first_group +\"{\" + matchobj.group(2) + \"}\"\n",
|
||||||
|
"#def refine_frac(string):\n",
|
||||||
|
"# for s in range(7):\n",
|
||||||
|
"# for t in range(7):\n",
|
||||||
|
"# string = re.sub(r\"frac[\\s]*leftbracket\"+str(s)+\"(.*?)\"+r\"rightbracket\"+str(s)+\"[\\s]*\"+r\"leftbracket\"+str(t)+\"(.*?)\"+r\"rightbracket\"+str(t),frac_brackets,string)\n",
|
||||||
|
"# return string\n",
|
||||||
|
"def refine_single_second_frac(string):\n",
|
||||||
|
" for s in range(7):\n",
|
||||||
|
" string = re.sub(r\"frac[\\s]*(\\w)[\\s]*leftbracket\"+str(s)+\"(.*?)\"+r\"rightbracket\"+str(s),frac_single_second_bracket,string)\n",
|
||||||
|
" return string\n",
|
||||||
|
"def refine_vital_bracket(string):\n",
|
||||||
|
" for s in range(7):\n",
|
||||||
|
" string = re.sub(r\"(frac)[\\s]*leftbracket\"+str(s)+\"(.*?)rightbracket\"+str(s),recall_vital_bracket,string)\n",
|
||||||
|
" string = re.sub(r\"(line)[\\s]*leftbracket\"+str(s)+\"(.*?)rightbracket\"+str(s),recall_vital_bracket,string)\n",
|
||||||
|
" string = re.sub(r\"(arrow)[\\s]*leftbracket\"+str(s)+\"(.*?)rightbracket\"+str(s),recall_vital_bracket,string)\n",
|
||||||
|
" string = re.sub(r\"(_)[\\s]*leftbracket\"+str(s)+\"(.*?)rightbracket\"+str(s),recall_vital_bracket,string)\n",
|
||||||
|
" string = re.sub(r\"(\\^)[\\s]*leftbracket\"+str(s)+\"(.*?)rightbracket\"+str(s),recall_vital_bracket,string)\n",
|
||||||
|
" string = re.sub(r\"(mathrm)[\\s]*leftbracket\"+str(s)+\"(.*?)rightbracket\"+str(s),recall_vital_bracket,string)\n",
|
||||||
|
" string = re.sub(r\"(mathbf)[\\s]*leftbracket\"+str(s)+\"(.*?)rightbracket\"+str(s),recall_vital_bracket,string)\n",
|
||||||
|
" string = re.sub(r\"(begin)[\\s]*leftbracket\"+str(s)+\"(.*?)rightbracket\"+str(s),recall_vital_bracket,string)\n",
|
||||||
|
" string = re.sub(r\"(end)[\\s]*leftbracket\"+str(s)+\"(.*?)rightbracket\"+str(s),recall_vital_bracket,string)\n",
|
||||||
|
" return string\n",
|
||||||
|
"def refine_sqrt(string):\n",
|
||||||
|
" for s in range(7):\n",
|
||||||
|
" string = re.sub(r\"sqrt[\\s]*(\\[\\w*\\])*[\\s]*leftbracket\"+str(s)+\"(.*?)rightbracket\"+str(s),sqrt_brackets,string)\n",
|
||||||
|
" return string\n",
|
||||||
|
"def give_blanks(string):\n",
|
||||||
|
" string = re.sub(r\"(sqrt[\\w])\",insert_a_blank,string)\n",
|
||||||
|
" string = re.sub(r\"(frac[\\w])\",insert_a_blank,string)\n",
|
||||||
|
" return string\n",
|
||||||
|
"def give_brackets(string):\n",
|
||||||
|
" string = re.sub(r\"leftbracket\\d\",\"\",string)\n",
|
||||||
|
" string = re.sub(r\"rightbracket\\d\",\"\",string)\n",
|
||||||
|
" string = re.sub(r\"leftset\",r\"\\{\",string)\n",
|
||||||
|
" string = re.sub(r\"rightset\",r\"\\}\",string)\n",
|
||||||
|
" return string\n",
|
||||||
|
"#以上是20220715新加的文本处理机制\n",
|
||||||
|
"def initial_bracket_search(string):\n",
|
||||||
|
" t = re.search(r\"^[\\s]*?leftbracket(\\d)\",string)\n",
|
||||||
|
" if t == None:\n",
|
||||||
|
" return -1\n",
|
||||||
|
" else:\n",
|
||||||
|
" return t.span()[1]\n",
|
||||||
|
"def initial_brackets_pair_search(string,d):\n",
|
||||||
|
" t = re.search(\"rightbracket\"+d,string)\n",
|
||||||
|
" if t == None:\n",
|
||||||
|
" return -1\n",
|
||||||
|
" else:\n",
|
||||||
|
" return t.span()[1]\n",
|
||||||
|
"def refine_frac(string):\n",
|
||||||
|
" eq_left = \"\"\n",
|
||||||
|
" eq_right = string\n",
|
||||||
|
" while re.search(\"frac\",eq_right) != None:\n",
|
||||||
|
" pos = re.search(\"frac\",eq_right)\n",
|
||||||
|
" eq_left += eq_right[:pos.span()[1]]\n",
|
||||||
|
" eq_right = eq_right[pos.span()[1]:]\n",
|
||||||
|
" if initial_bracket_search(eq_right)>0:\n",
|
||||||
|
" pos = initial_brackets_pair_search(eq_right,eq_right[initial_bracket_search(eq_right)-1])\n",
|
||||||
|
" first_bracket = eq_right[:pos]\n",
|
||||||
|
" first_layer = first_bracket[-1]\n",
|
||||||
|
" eq_remain = eq_right[pos:]\n",
|
||||||
|
" if initial_bracket_search(eq_remain)>0:\n",
|
||||||
|
" pos = initial_brackets_pair_search(eq_remain,eq_remain[initial_bracket_search(eq_remain)-1])\n",
|
||||||
|
" second_bracket = eq_remain[:pos]\n",
|
||||||
|
" second_layer = second_bracket[-1]\n",
|
||||||
|
" first_bracket = re.sub(r\"leftbracket\"+first_layer,\"{\",first_bracket)\n",
|
||||||
|
" second_bracket = re.sub(r\"leftbracket\"+second_layer,\"{\",second_bracket)\n",
|
||||||
|
" first_bracket = re.sub(r\"rightbracket\"+first_layer,\"}\",first_bracket)\n",
|
||||||
|
" second_bracket = re.sub(r\"rightbracket\"+second_layer,\"}\",second_bracket)\n",
|
||||||
|
" eq_right = first_bracket+second_bracket+eq_remain[pos:]\n",
|
||||||
|
" return eq_left+eq_right\n",
|
||||||
|
"#以上是20220718修改的大括号处理机制, 修复了一个bug\n",
|
||||||
|
"def reduce_blank(matchobj):\n",
|
||||||
|
" return matchobj.group(1).replace(\" \",\"\")\n",
|
||||||
|
"def add_dollars(matchobj):\n",
|
||||||
|
" return matchobj.group(1)[0] + r\"$\" + matchobj.group(1)[1:-1] + r\"$\" + matchobj.group(1)[-1]\n",
|
||||||
|
"def del_first_char(matchobj):\n",
|
||||||
|
" return matchobj.group(1)[1:]\n",
|
||||||
|
"def add_underline(matchobj):\n",
|
||||||
|
" return matchobj.group(1)[0] + \"_\" + matchobj.group(1)[-1]\n",
|
||||||
|
"def brackets_to_cwords(matchobj):\n",
|
||||||
|
" return \"左括号\"+matchobj.group(1)+\"右括号\"\n",
|
||||||
|
"def cwords_to_brackets(matchobj):\n",
|
||||||
|
" return \"(\"+matchobj.group(1)+\")\"\n",
|
||||||
|
"def circled_brackets(matchobj):\n",
|
||||||
|
" return matchobj.group(1)[:-1]+\"{\"+matchobj.group(1)[-1] + \"}\"\n",
|
||||||
|
"\n",
|
||||||
|
"# try:\n",
|
||||||
|
"# os.chdir(r\"D:\\mathdept\\mathdept\\文本处理程序等\")\n",
|
||||||
|
"# except:\n",
|
||||||
|
"# os.chdir(r\"D:\\mathdept\\文本处理程序等\")\n",
|
||||||
|
"# with open(\"textfile.txt\", \"r\", encoding = \"utf8\") as textfile:\n",
|
||||||
|
"# data = textfile.read()\n",
|
||||||
|
"\n",
|
||||||
|
"filename = getCopy().strip()\n",
|
||||||
|
"if not filename[-4:] == \".tex\":\n",
|
||||||
|
" filename += \".tex\"\n",
|
||||||
|
"with open(r\"C:\\Users\\weiye\\Documents\\wwy sync\\待整理word题目\\高考数学风暴tex/\"+filename,\"r\",encoding = \"u8\") as f:\n",
|
||||||
|
" raw_data = f.read()\n",
|
||||||
|
"data = re.findall(r\"\\\\begin\\{enumerate\\}([\\s\\S]*?)\\\\end\\{enumerate\\}\",raw_data)[0]\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"#去除左右括号的前缀\n",
|
||||||
|
"data = data.replace(r\"\\rightarrow\",r\"\\to\")\n",
|
||||||
|
"data = data.replace(r\"\\left.\",\"\").replace(r\"\\left\",\"\").replace(r\"\\right.\",\"\").replace(r\"\\right\",\"\")\n",
|
||||||
|
"\n",
|
||||||
|
"#全角半角符号替换\n",
|
||||||
|
"data = re.sub(\" \",\" \",data)\n",
|
||||||
|
"data = re.sub(\"(。[\\n]*)\",full_stop,data)\n",
|
||||||
|
"data = re.sub(\"(.[\\n]*)\",full_stop,data)\n",
|
||||||
|
"data = re.sub(\",\",\", \",data)\n",
|
||||||
|
"data = re.sub(\":\",\": \",data)\n",
|
||||||
|
"data = re.sub(\";\",\"; \",data)\n",
|
||||||
|
"data = re.sub(\"(\",\"(\",data)\n",
|
||||||
|
"data = re.sub(\")\",\")\",data)\n",
|
||||||
|
"data = re.sub(\"?\",\"? \",data)\n",
|
||||||
|
"data = re.sub(\"“\",\"``\",data)\n",
|
||||||
|
"data = re.sub(\"”\",\"''\",data)\n",
|
||||||
|
"data = re.sub(\" ``\",\"``\",data)\n",
|
||||||
|
"data = re.sub(\"'' \",\"''\",data)\n",
|
||||||
|
"\n",
|
||||||
|
"#替换题号\n",
|
||||||
|
"data = re.sub(\"(^[例]*[0-9]+[\\s]*\\.[\\s]+)\",\"\\\\n\\\\\\\\item \",data)\n",
|
||||||
|
"data = re.sub(\"(\\\\n[例]*[0-9]+[\\s]*\\.[\\s]+)\",\"\\\\n\\\\\\\\item \",data)\n",
|
||||||
|
"\n",
|
||||||
|
"#公式标志换成$符号\n",
|
||||||
|
"data = re.sub(\"\\\\\\\\\\[\",r\"$\",data)\n",
|
||||||
|
"data = re.sub(\"\\\\\\\\\\]\",r\"$\",data)\n",
|
||||||
|
"data = re.sub(\"\\$\\$\",\"\",data)\n",
|
||||||
|
"\n",
|
||||||
|
"#标点和$符号分开\n",
|
||||||
|
"data = re.sub(r\"([,.:;])\\$\",lambda x:x.group(1)+\" $\",data)\n",
|
||||||
|
"\n",
|
||||||
|
"#选择题替换成标准格式\n",
|
||||||
|
"data = re.sub(\"A\\.([\\s\\S]*?)B\\.([\\s\\S]*?)C\\.([\\s\\S]*?)D\\.([\\s\\S]*?)\\\\n\",multiple_choice,data)\n",
|
||||||
|
"data = re.sub(\"\\(A\\)([\\s\\S]*?)\\(B\\)([\\s\\S]*?)\\(C\\)([\\s\\S]*?)\\(D\\)([\\s\\S]*?)\\\\n\",multiple_choice,data)\n",
|
||||||
|
"data = re.sub(\"A\\.([\\s\\S]*?)B\\.([\\s\\S]*?)C\\.([\\s\\S]*?)D\\.([\\s\\S]*?)\\\\n\",multiple_choice,data)\n",
|
||||||
|
"data = re.sub(\"\\(A\\)([\\s\\S]*?)\\(B\\)([\\s\\S]*?)\\(C\\)([\\s\\S]*?)\\(D\\)([\\s\\S]*?)\\\\n\",multiple_choice,data)\n",
|
||||||
|
"data = re.sub(\"\\$[ ]+\\}\",\"$}\",data)\n",
|
||||||
|
"data = re.sub(\"\\{[ ]+\\$\",\"{$\",data)\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"data = re.sub(r\"\\\\_\\\\_\\\\_\\\\_\", r\"\\\\blank{50}\",data)\n",
|
||||||
|
"data = re.sub(r\"\\\\[\\(\\)]\",\"$\",data)\n",
|
||||||
|
"datalines = [l.strip() for l in data.split(\"\\n\") if len(l.strip())>0]\n",
|
||||||
|
"data = \"\\n\".join(datalines)\n",
|
||||||
|
"\n",
|
||||||
|
"#替换frac为dfrac\n",
|
||||||
|
"data = data.replace(\"\\\\frac\",\"\\\\dfrac\")\n",
|
||||||
|
"\n",
|
||||||
|
"#替换多余的空行\n",
|
||||||
|
"for i in range(20):\n",
|
||||||
|
" data = re.sub(\"\\n[\\t ]*\\n\",\"\\n\",data)\n",
|
||||||
|
"\n",
|
||||||
|
"#删除\\quad\n",
|
||||||
|
"data = re.sub(r\"\\\\q+uad\",\"\",data)\n",
|
||||||
|
"\n",
|
||||||
|
"#删除~\n",
|
||||||
|
"data = re.sub(r\"~\",\"\",data)\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"data1 = data #替换后暂存data1\n",
|
||||||
|
"\n",
|
||||||
|
"#分离文字和公式\n",
|
||||||
|
"raw_texts = [] #文字数组\n",
|
||||||
|
"raw_equations = [] #公式数组\n",
|
||||||
|
"d = data\n",
|
||||||
|
"while len(d) > 0:\n",
|
||||||
|
" interval = re.search(r\"\\$[\\s\\S]*?\\$\",d)\n",
|
||||||
|
" if not interval == None:\n",
|
||||||
|
" (start, end) = interval.span()\n",
|
||||||
|
" raw_texts.append(d[:start])\n",
|
||||||
|
" raw_equations.append(d[start:end])\n",
|
||||||
|
" d = d[end:]\n",
|
||||||
|
" else:\n",
|
||||||
|
" raw_texts.append(d)\n",
|
||||||
|
" d = \"\"\n",
|
||||||
|
"#至此已经分离了文字和公式,公式在两个$之内,包含两个$\n",
|
||||||
|
"\n",
|
||||||
|
"modified_texts = []\n",
|
||||||
|
"modified_equations = []\n",
|
||||||
|
"\n",
|
||||||
|
"for text in raw_texts:\n",
|
||||||
|
" text1 = text\n",
|
||||||
|
" #删除选项中无用的空格\n",
|
||||||
|
" text1 = re.sub(\"\\{[\\s]+?\",\"{\",text1)\n",
|
||||||
|
" text1 = re.sub(\"[\\s]+?\\}\",\"}\",text1)\n",
|
||||||
|
" text1 = re.sub(r\"\\\\ \",\" \",text1)\n",
|
||||||
|
" #填空题的处理\n",
|
||||||
|
" # text1 = re.sub(\"[ _]{2,}\",r\"\\\\blank{50}\",text1)\n",
|
||||||
|
" #选择题的处理\n",
|
||||||
|
" text1 = re.sub(r\"\\(\\\\blank\\{50\\}\\)\",\"\\\\\\\\bracket{20}\",text1)\n",
|
||||||
|
" text1 = re.sub(r\"\\([\\s]{1,10}\\)\",\"\\\\\\\\bracket{20}\",text1)\n",
|
||||||
|
" #逗号后面加空格\n",
|
||||||
|
" text1 = re.sub(\",[ ]*\",\", \",text1)\n",
|
||||||
|
" text1 = re.sub(r\"\\.\\}\",\"}\",text1)\n",
|
||||||
|
" text1 = re.sub(r\"\\n\\d{1,3}\\.\",r\"\\n\\\\item \",text1)\n",
|
||||||
|
" # text1 = re.sub(r\"\\s{2,}\\.\",r\"\\\\blank{50}.\",text1)\n",
|
||||||
|
" # text1 = re.sub(r\"\\s{2,}\\,\",r\"\\\\blank{50},\",text1)\n",
|
||||||
|
" text1 = re.sub(r\"\\s*\\\\bracket\\{20\\}\\s*\\n\",r\"\\\\bracket{20}.\\n\",text1)\n",
|
||||||
|
" #改非规范选择题\n",
|
||||||
|
" text1 = re.sub(r\"[\\.;]\\}\",\"}\",text1)\n",
|
||||||
|
" text1 = re.sub(r\"([\\u4e00-\\u9fa5])[\\s]+([\\d]{1,6})[\\s]+([\\u4e00-\\u9fa5])\",lambda x:x.group(1)+\"$\"+x.group(2)+\"$\"+x.group(3),text1)\n",
|
||||||
|
" modified_texts.append(text1)\n",
|
||||||
|
" \n",
|
||||||
|
"\n",
|
||||||
|
"for equation in raw_equations:\n",
|
||||||
|
" equation1 = equation\n",
|
||||||
|
" if equation1[1] == \"{\" and equation1[-2] == \"}\":\n",
|
||||||
|
" equation1 = \"$\" + equation1[2:-2] + \"$\"\n",
|
||||||
|
" #删除一些无效大括号\n",
|
||||||
|
" for i in range(3):\n",
|
||||||
|
" equation1 = re.sub(r\"_\\{([0-9a-zA-Z])\\}\",lambda x:\"_\"+x.group(1),equation1)\n",
|
||||||
|
" equation1 = re.sub(r\"\\^\\{([0-9a-zA-Z])\\}\",lambda x:\"^\"+x.group(1),equation1)\n",
|
||||||
|
" #合并一些公式中的无效空格\n",
|
||||||
|
" for i in range(2):\n",
|
||||||
|
" equation1 = re.sub(r\"([0-9A-Z])\\s+([0-9A-Z])\",lambda x:x.group(1)+x.group(2),equation1)\n",
|
||||||
|
" #改变组合数和排列数\n",
|
||||||
|
" equation1 = re.sub(r\"([CP])(_[^_\\^]{,5}\\^)\",lambda x:r\"\\mathrm{\"+x.group(1)+\"}\"+x.group(2),equation1)\n",
|
||||||
|
" #改单位\n",
|
||||||
|
" equation1 = re.sub(r\"mathrm\\{cm\\}\",\"text{cm}\",equation1)\n",
|
||||||
|
" equation1 = re.sub(r\"mathrm\\{km\\}\",\"text{km}\",equation1)\n",
|
||||||
|
" modified_equations.append(equation1)\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"#整合修改过的文本和公式 \n",
|
||||||
|
"modified_data = \"\"\n",
|
||||||
|
"for i in range(len(modified_texts)):\n",
|
||||||
|
" try:\n",
|
||||||
|
" modified_data += modified_texts[i]\n",
|
||||||
|
" except:\n",
|
||||||
|
" a = 1\n",
|
||||||
|
" try:\n",
|
||||||
|
" modified_data += modified_equations[i]\n",
|
||||||
|
" except:\n",
|
||||||
|
" a = 1\n",
|
||||||
|
"modified_data = re.sub(r\"[ ]+\\n\",\"\\n\",modified_data)\n",
|
||||||
|
"modified_data = re.sub(r\"\\$[\\s]*?\\\\parallel[\\s]*?\\$\",r\"\\\\parallel\",modified_data)\n",
|
||||||
|
"modified_data = re.sub(r\"\\n例\\s*?\\d{1,3}\\s*\",r\"\\n\\\\item \",modified_data)\n",
|
||||||
|
"modified_data = re.sub(r\"(\\$[\\,\\.:;]\\$)\",refine_brackets,modified_data)\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"#以下是mathpix之后的空格去除\n",
|
||||||
|
"for i in range(3):\n",
|
||||||
|
" modified_data = re.sub(r\"([\\u4e00-\\u9fa5])( )([\\u4e00-\\u9fa5])\",lambda x:x.group(1)+x.group(3),modified_data)\n",
|
||||||
|
" modified_data = re.sub(r\"\\$ \",\"$\",modified_data)\n",
|
||||||
|
" modified_data = re.sub(r\" \\$\",\"$\",modified_data)\n",
|
||||||
|
"#mathpix的错别字修改\n",
|
||||||
|
"modified_data = modified_data.replace(\"雉\",\"锥\")\n",
|
||||||
|
"modified_data = re.sub(\"[粗秿]圆\",\"椭圆\",modified_data)\n",
|
||||||
|
"modified_data = modified_data.replace(\"针角\",\"钝角\")\n",
|
||||||
|
"modified_data = re.sub(\"投郑\",\"投掷\",modified_data)\n",
|
||||||
|
"modified_data = re.sub(\"抛郑\",\"抛掷\",modified_data)\n",
|
||||||
|
"modified_data = re.sub(\"范目\",\"范围\",modified_data)\n",
|
||||||
|
"modified_data = re.sub(\"揷\",\"插\",modified_data)\n",
|
||||||
|
"#mathpix的自由向量修改\n",
|
||||||
|
"modified_data = modified_data.replace(r\"\\vec\",r\"\\overrightarrow \")\n",
|
||||||
|
"modified_data = modified_data.replace(r\"\\bar\",r\"\\overline \")\n",
|
||||||
|
"#mathpix的极限修改\n",
|
||||||
|
"modified_data = re.sub(r\"\\\\lim[\\s]*_\\{n \\\\to \\\\infty\\}\",r\"\\\\displaystyle\\\\lim_{n\\\\to\\\\infty}\",modified_data)\n",
|
||||||
|
"#mathpix的顿号修改\n",
|
||||||
|
"modified_data = modified_data.replace(r\" 、 \",r\"$、$\")\n",
|
||||||
|
"#改slant等\n",
|
||||||
|
"modified_data = modified_data.replace(r\"slant\",\"\")\n",
|
||||||
|
"modified_data = modified_data.replace(r\"\\mid\",\"|\")\n",
|
||||||
|
"modified_data = re.sub(r\"\\\\mathrm\\{\\\\mathrm\\{i\\}\\}\",r\"\\\\mathrm{i}\",modified_data)\n",
|
||||||
|
"modified_data = modified_data.replace(\",$\",\", $\")\n",
|
||||||
|
"modified_data = modified_data.replace(\" / /\",r\"\\parallel\")\n",
|
||||||
|
"modified_data = modified_data.replace(\"mathrmR\",r\"mathbf{R}\")\n",
|
||||||
|
"modified_data = modified_data.replace(r\"^{\\prime}\",\"'\")\n",
|
||||||
|
"modified_data = re.sub(r\"\\^\\{\\\\dfrac\",r\"^{\\\\frac\",modified_data)\n",
|
||||||
|
"modified_data = re.sub(r\"\\^\\{-\\\\dfrac\",r\"^{-\\\\frac\",modified_data)\n",
|
||||||
|
"modified_data = re.sub(r\"_\\{\\\\dfrac\",r\"_{\\\\frac\",modified_data)\n",
|
||||||
|
"modified_data = re.sub(r\"_\\{-\\\\dfrac\",r\"_{-\\\\frac\",modified_data)\n",
|
||||||
|
"\n",
|
||||||
|
"#改分段函数等\n",
|
||||||
|
"modified_data = re.sub(r\"\\\\{\\\\begin\\{array\\}\\{[rcl]*\\}\",r\"\\\\begin{cases}\",modified_data)\n",
|
||||||
|
"modified_data = re.sub(r\"\\\\end{array}\",r\"\\\\end{cases}\",modified_data)\n",
|
||||||
|
"\n",
|
||||||
|
"#冒号后加空格\n",
|
||||||
|
"modified_data = re.sub(r\":([\\S])\", lambda x:\": \"+x.group(1),modified_data)\n",
|
||||||
|
"\n",
|
||||||
|
"#识别填空题加空格\n",
|
||||||
|
"modified_data = re.sub(r\"([\\u4e00-\\u9fa5\\$])[\\s]*\\n\\\\item\",lambda x: x.group(1)+\"\\\\blank{50}.\\n\\\\item\",modified_data)\n",
|
||||||
|
"\n",
|
||||||
|
"#识别选择题加括号\n",
|
||||||
|
"modified_data = re.sub(r\"\\$\\(\\s*\\)\\$\",r\"\\\\bracket{20}\",modified_data)\n",
|
||||||
|
"modified_data = re.sub(r\"([\\u4e00-\\u9fa5\\$])[\\s]*\\n\\\\fourch\",lambda x: x.group(1)+\"\\\\bracket{20}.\\n\\\\fourch\",modified_data)\n",
|
||||||
|
"\n",
|
||||||
|
"#改圆弧\n",
|
||||||
|
"modified_data = re.sub(r\"overparen\",r\"overset\\\\frown\",modified_data)\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"setCopy(modified_data)\n",
|
||||||
|
"\n",
|
||||||
|
"with open(\"临时文件/outputfile.txt\",\"w\",encoding = \"utf8\") as f:\n",
|
||||||
|
" f.write(modified_data)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
||||||
3100
题库0.3/Problems.json
3100
题库0.3/Problems.json
File diff suppressed because it is too large
Load Diff
Reference in New Issue