20230119 noon

This commit is contained in:
WangWeiye 2023-01-19 10:46:57 +08:00
parent 2da034fa38
commit 1e92b3d2d0
1 changed files with 14 additions and 5 deletions

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -235,6 +235,9 @@
"#删除\\quad\n", "#删除\\quad\n",
"data = re.sub(r\"\\\\q+uad\",\"\",data)\n", "data = re.sub(r\"\\\\q+uad\",\"\",data)\n",
"\n", "\n",
"#删除~\n",
"data = re.sub(r\"~\",\"\",data)\n",
"\n",
"\n", "\n",
"\n", "\n",
"data1 = data #替换后暂存data1\n", "data1 = data #替换后暂存data1\n",
@ -287,7 +290,8 @@
" equation1 = re.sub(r\"([0-9A-Z])\\s+([0-9A-Z])\",lambda x:x.group(1)+x.group(2),equation1)\n", " equation1 = re.sub(r\"([0-9A-Z])\\s+([0-9A-Z])\",lambda x:x.group(1)+x.group(2),equation1)\n",
" #改变组合数和排列数\n", " #改变组合数和排列数\n",
" equation1 = re.sub(r\"([CP])(_[^_\\^]{,5}\\^)\",lambda x:r\"\\mathrm{\"+x.group(1)+\"}\"+x.group(2),equation1)\n", " equation1 = re.sub(r\"([CP])(_[^_\\^]{,5}\\^)\",lambda x:r\"\\mathrm{\"+x.group(1)+\"}\"+x.group(2),equation1)\n",
" \n", " #改单位\n",
" equation1 = re.sub(r\"mathrm\\{cm\\}\",\"text{cm}\",equation1)\n",
" modified_equations.append(equation1)\n", " modified_equations.append(equation1)\n",
"\n", "\n",
"\n", "\n",
@ -315,8 +319,10 @@
" modified_data = re.sub(r\" \\$\",\"$\",modified_data)\n", " modified_data = re.sub(r\" \\$\",\"$\",modified_data)\n",
"#mathpix的错别字修改\n", "#mathpix的错别字修改\n",
"modified_data = modified_data.replace(\"雉\",\"锥\")\n", "modified_data = modified_data.replace(\"雉\",\"锥\")\n",
"modified_data = modified_data.replace(\"粗圆\",\"椭圆\")\n", "modified_data = re.sub(\"[粗秿]圆\",\"椭圆\",modified_data)\n",
"modified_data = modified_data.replace(\"针角\",\"钝角\")\n", "modified_data = modified_data.replace(\"针角\",\"钝角\")\n",
"modified_data = re.sub(\"投郑\",\"投掷\",modified_data)\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",
@ -341,6 +347,9 @@
"modified_data = re.sub(r\"\\\\{\\\\begin\\{array\\}\\{[rcl]*\\}\",r\"\\\\begin{cases}\",modified_data)\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", "modified_data = re.sub(r\"\\\\end{array}\",r\"\\\\end{cases}\",modified_data)\n",
"\n", "\n",
"#冒号后加空格\n",
"modified_data = re.sub(r\":([\\S])\", lambda x:\": \"+x.group(1),modified_data)\n",
"\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", "modified_data = re.sub(r\"([\\u4e00-\\u9fa5\\$])[\\s]*\\n\\\\item\",lambda x: x.group(1)+\"\\\\blank{50}.\\n\\\\item\",modified_data)\n",
"\n", "\n",
@ -378,12 +387,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"
} }
} }
}, },