From 90ed80a6e0249fc2191081f14457a79604998067 Mon Sep 17 00:00:00 2001 From: "weiye.wang" Date: Fri, 7 Jun 2024 00:06:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=94=B6=E5=BD=95=E6=96=B0?= =?UTF-8?q?=E9=A2=98=E7=9A=84=E6=96=B0=E9=A2=98=E6=AF=94=E5=AF=B9=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v4/批量收录新题.py | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/工具v4/批量收录新题.py b/工具v4/批量收录新题.py index d249b8e0..ddeb21b6 100644 --- a/工具v4/批量收录新题.py +++ b/工具v4/批量收录新题.py @@ -51,33 +51,24 @@ class MyWindow_bdsl(QWidget,Ui_Form): problems_raw = re.findall(r"\\begin\{enumerate\}([\s\S]*?)\\end\{enumerate\}",data_raw) data = "\n".join([item.strip() for item in problems_raw]) problems = [(d.strip()) for d in data.split("\\item") if not d.strip() == ""] - output = "使用说明:\\\\\n rep??????表示使用已有题号??????,\\\\\n s??????表示和??????相同,\\\\\n r??????表示和??????相关\n\n\\begin{enumerate}\n\n" + output = "使用说明:\\\\\n ??????(rep)表示使用已有题号??????,\\\\\n ??????(s)表示和??????相同,\\\\\n ??????(r)表示和??????相关\n\n\\begin{enumerate}\n\n" for p in problems: p_treated = pre_treating(p) t = stringmaxsim(p_treated,treated_dict,5) - psrstring = "" - for id,simrate in t: - if simrate == 1: - psrstring = "rep"+id+"," - elif simrate > 0.5: - psrstring += id + "," - if psrstring[-1] == ",": - psrstring = psrstring[:-1] - if len(psrstring) > 0: - output += f"\\item [{psrstring}] {p}\n\n" - else: - output += f"\\item {p}\n\n" + output += f"\\item {p}\n\n" count = 0 for id,simrate in t: if simrate > 0.5: colors = get_color(simrate*2-1) output += "\n\\definecolor{mycolor}{rgb}"+colors - output += "\n\\begin{tcolorbox}"+f"[colback = mycolor, opacityback = 0.25, colframe = orange!10!white, breakable]\n" - output += f"{simrate:.3f} \\ {id}\n\n" + output += "\n\\begin{tcolorbox}"+f"[colback = mycolor, opacityback = 0.25, colframe = orange!10!white, breakable]\n\n" + output += "\\begin{flushright}\\begin{Large}\n" + output += f"{simrate:.3f} \\ {id}()\n" + output += "\\end{Large}\\end{flushright}" content = pro_dict[id] - output += f"{content}\n" + output += f"\n{content}\n" output += "\\end{tcolorbox}\n" count += 1 output += "\n\n" @@ -130,6 +121,8 @@ class MyWindow_bdsl(QWidget,Ui_Form): self.db.commit() self.db.close() print("已提交至数据库") + self.pushButton_commit.setDisabled(True) + self.problemstoimport = []