From 629e115dc0e2c7691f6377caf67dd8e5ff7cfe56 Mon Sep 17 00:00:00 2001 From: "weiye.wang" Date: Sun, 4 Feb 2024 11:35:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=B0=E9=A2=98=E6=AF=94?= =?UTF-8?q?=E5=AF=B9=E7=9A=84=E4=B8=80=E4=BA=9B=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v2/新题比对.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/工具v2/新题比对.py b/工具v2/新题比对.py index 98f35b26..b415a61d 100644 --- a/工具v2/新题比对.py +++ b/工具v2/新题比对.py @@ -10,15 +10,14 @@ pro_dict = load_dict("../题库0.3/problems.json") treated_dict = treat_dict(pro_dict) data = getCopy() problems = [(d.strip()) for d in data.split("\\item") if not d.strip() == ""] -output = "使用说明: repxxxxxx表示使用已有题号xxxxxx, sxxxxxx,yyyyyy,...表示和xxxxxx,yyyyyy,...相同, rxxxxxx,yyyyyy,...表示和xxxxxx,yyyyyy,...相关\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,3) + t = stringmaxsim(p_treated,treated_dict,5) psrstring = "" for id,simrate in t: if simrate == 1: - psrstring = "rep"+id - break + psrstring = "rep"+id+"," else: psrstring += id + "," if psrstring[-1] == ",": @@ -26,12 +25,15 @@ for p in problems: output += f"\\item [{psrstring}] {p}\n\n" count = 0 for id,simrate in t: - output += "\n\\begin{tcolorbox}"+f"[colback = {colors[count]}!10!white, colframe = orange!10!white, breakable]\n" - output += f"{simrate:.3f} \\ {id}\n\n" - content = pro_dict[id]["content"] - output += f"{content}\n" - output += "\\end{tcolorbox}\n" - count += 1 + 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" + content = pro_dict[id]["content"] + output += f"{content}\n" + output += "\\end{tcolorbox}\n" + count += 1 output += "\n\n" output += "\n\\end{enumerate}\n\n"