20230128 afternoon 收录了2021年空中课堂高三复习课的题目

This commit is contained in:
WangWeiye 2023-01-28 15:01:48 +08:00
parent a51c57e384
commit 5ef4c627ee
6 changed files with 7848 additions and 34 deletions

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -59,12 +59,12 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.15" "version": "3.8.15"
}, },
"orig_nbformat": 4, "orig_nbformat": 4,
"vscode": { "vscode": {
"interpreter": { "interpreter": {
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc" "hash": "42dd566da87765ddbe9b5c5b483063747fec4aacc5469ad554706e4b742e67b2"
} }
} }
}, },

View File

@ -2,21 +2,21 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 28,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"#修改起始id,出处,文件名\n", "#修改起始id,出处,文件名\n",
"starting_id = 13587\n", "starting_id = 13692\n",
"origin = \"2022版双基百分百\"\n", "origin = \"2021年空中课堂高三复习课\"\n",
"filename = r\"C:\\Users\\weiye\\Documents\\wwy sync\\临时工作区\\双基百分百21to25.tex\"\n", "filename = r\"D:\\temp\\2022kzkt.tex\"\n",
"editor = \"20230123\\t王伟叶\"\n", "editor = \"20230128\\t王伟叶\"\n",
"indexed = False\n" "indexed = False\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 29,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -25,15 +25,24 @@
"#从enumerate环境的字符串生成题目列表\n", "#从enumerate环境的字符串生成题目列表\n",
"def GenerateProblemListFromString(data):\n", "def GenerateProblemListFromString(data):\n",
" try:\n", " try:\n",
" data = re.findall(r\"\\\\begin\\{document\\}([\\s\\S]*?)\\\\end\\{document\\}\",data)[0]\n", " data = re.findall(r\"\\\\begin\\{document\\}([\\s\\S]*?)\\\\end\\{document\\}\",problems_string)[0]\n",
" except:\n", " except:\n",
" pass\n", " pass\n",
" data = re.sub(r\"\\n[\\s]*?\\%[\\s\\S]*?\\n\",\"\\n\",data)\n",
" data = re.sub(r\"\\n{2,}\",\"\\n\",data)\n", " data = re.sub(r\"\\n{2,}\",\"\\n\",data)\n",
" data = re.sub(r\"\\\\item\",r\"\\\\enditem\\\\item\",data)\n", " data = re.sub(r\"\\\\item\",r\"\\\\enditem\\\\item\",data)\n",
" data = re.sub(r\"\\\\end\\{enumerate\\}\",r\"\\\\enditem\",data)\n", " data = re.sub(r\"\\\\end\\{enumerate\\}\",r\"\\\\enditem\",data)\n",
" ProblemList = [p.strip() for p in re.findall(r\"\\\\item([\\s\\S]*?)\\\\enditem\",data)]\n", " ProblemList_raw = [p.strip() for p in re.findall(r\"\\\\item([\\s\\S]*?)\\\\enditem\",data)]\n",
" return ProblemList\n", " ProblemsList = []\n",
" for p in ProblemList_raw:\n",
" startpos = data.index(p)\n",
" tempdata = data[:startpos]\n",
" suflist = re.findall(r\"\\%\\d+\",tempdata)\n",
" if len(suflist) > 0:\n",
" suffix = suflist[-1].replace(\"%\",\"\")\n",
" else:\n",
" suffix = \"\"\n",
" ProblemsList.append((p,suffix))\n",
" return ProblemsList\n",
"\n", "\n",
"# 创建新的空题目\n", "# 创建新的空题目\n",
"def CreateEmptyProblem(problem):\n", "def CreateEmptyProblem(problem):\n",
@ -66,15 +75,18 @@
" problems_string = f.read()\n", " problems_string = f.read()\n",
"problems = GenerateProblemListFromString(problems_string)\n", "problems = GenerateProblemListFromString(problems_string)\n",
"\n", "\n",
"\n",
"id = starting_id\n", "id = starting_id\n",
"for p in problems:\n", "for p_and_suffix in problems:\n",
" p = p_and_suffix[0]\n",
" suffix = p_and_suffix[1]\n",
" pid = str(id).zfill(6)\n", " pid = str(id).zfill(6)\n",
" 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 , dict = pro_dict,editor = editor)\n", " NewProblem = CreateNewProblem(id = pid, content = p, origin = origin + suffix , dict = pro_dict,editor = editor)\n",
" else:\n", " else:\n",
" NewProblem = CreateNewProblem(id = pid, content = p, origin = origin + \"试题\" + str(id- starting_id+1), dict = pro_dict,editor = editor)\n", " NewProblem = CreateNewProblem(id = pid, content = p, origin = origin + suffix + \"试题\" + str(id- starting_id+1), dict = pro_dict,editor = editor)\n",
" pro_dict[pid] = NewProblem\n", " pro_dict[pid] = NewProblem\n",
" id += 1\n", " id += 1\n",
"\n", "\n",
@ -93,13 +105,6 @@
"else:\n", "else:\n",
" print(\"题号有重复, 请检查.\\n\"*5)" " print(\"题号有重复, 请检查.\\n\"*5)"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {
@ -118,12 +123,12 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.15" "version": "3.8.15"
}, },
"orig_nbformat": 4, "orig_nbformat": 4,
"vscode": { "vscode": {
"interpreter": { "interpreter": {
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc" "hash": "42dd566da87765ddbe9b5c5b483063747fec4aacc5469ad554706e4b742e67b2"
} }
} }
}, },

View File

@ -45,7 +45,7 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "mathdept", "display_name": "pythontest",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -64,7 +64,7 @@
"orig_nbformat": 4, "orig_nbformat": 4,
"vscode": { "vscode": {
"interpreter": { "interpreter": {
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc" "hash": "91219a98e0e9be72efb992f647fe78b593124968b75db0b865552d6787c8db93"
} }
} }
}, },

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -330,7 +330,7 @@
"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",
"modified_data = re.sub(\"范目\",\"范围\",modified_data)\n", "modified_data = re.sub(\"范目\",\"范围\",modified_data)\n",
"\n", "modified_data = re.sub(\"揷\",\"插\",modified_data)\n",
"#mathpix的自由向量修改\n", "#mathpix的自由向量修改\n",
"modified_data = modified_data.replace(r\"\\vec\",r\"\\overrightarrow \")\n", "modified_data = modified_data.replace(r\"\\vec\",r\"\\overrightarrow \")\n",
"modified_data = modified_data.replace(r\"\\bar\",r\"\\overline \")\n", "modified_data = modified_data.replace(r\"\\bar\",r\"\\overline \")\n",
@ -398,12 +398,12 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.15" "version": "3.8.15"
}, },
"orig_nbformat": 4, "orig_nbformat": 4,
"vscode": { "vscode": {
"interpreter": { "interpreter": {
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc" "hash": "42dd566da87765ddbe9b5c5b483063747fec4aacc5469ad554706e4b742e67b2"
} }
} }
}, },

View File

@ -68,7 +68,7 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "mathdept", "display_name": "pythontest",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -82,12 +82,12 @@
"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": {
"interpreter": { "interpreter": {
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc" "hash": "91219a98e0e9be72efb992f647fe78b593124968b75db0b865552d6787c8db93"
} }
} }
}, },

File diff suppressed because it is too large Load Diff