20230117 afternoon

This commit is contained in:
WangWeiye 2023-01-17 16:39:56 +08:00
parent d1162fa3a7
commit c49d502f8f
2 changed files with 12 additions and 9 deletions

View File

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
@ -206,8 +206,8 @@
"data = re.sub(\"'' \",\"''\",data)\n",
"\n",
"#替换题号\n",
"data = re.sub(\"(^[例]*[0-9]+\\.[\\s]+)\",\"\\\\n\\\\\\\\item \",data)\n",
"data = re.sub(\"(\\\\n[例]*[0-9]+\\.[\\s]+)\",\"\\\\n\\\\\\\\item \",data)\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",
@ -271,6 +271,9 @@
"\n",
"for equation in raw_equations:\n",
" equation1 = equation\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",
" modified_equations.append(equation1)\n",
"\n",
"\n",
@ -304,7 +307,7 @@
"modified_data = modified_data.replace(r\"\\vec\",r\"\\overrightarrow \")\n",
"modified_data = modified_data.replace(r\"\\bar\",r\"\\overline \")\n",
"#mathpix的极限修改\n",
"modified_data = modified_data.replace(r\"\\lim _{n \\rightarrow \\infty}\",r\"\\displaystyle\\lim_{n\\to\\infty}\")\n",
"modified_data = modified_data.replace(r\"\\lim[\\s]*_{n \\rightarrow \\infty}\",r\"\\displaystyle\\lim_{n\\to\\infty}\")\n",
"#mathpix的顿号修改\n",
"modified_data = modified_data.replace(r\" 、 \",r\"$、$\")\n",
"#改slant等\n",
@ -317,11 +320,11 @@
"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",
"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\"\\\\{\\\\begin\\{array\\}\\{[rcl]*\\}\",r\"\\\\begin{cases}\",modified_data)\n",
"modified_data = re.sub(r\"\\\\end{array}\",r\"\\\\end{cases}\",modified_data)\n",
"\n",
"\n",
@ -355,12 +358,12 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.15"
"version": "3.8.15"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc"
"hash": "42dd566da87765ddbe9b5c5b483063747fec4aacc5469ad554706e4b742e67b2"
}
}
},