优化新题比对的一些细节
This commit is contained in:
parent
52fd88261b
commit
629e115dc0
22
工具v2/新题比对.py
22
工具v2/新题比对.py
|
|
@ -10,15 +10,14 @@ pro_dict = load_dict("../题库0.3/problems.json")
|
||||||
treated_dict = treat_dict(pro_dict)
|
treated_dict = treat_dict(pro_dict)
|
||||||
data = getCopy()
|
data = getCopy()
|
||||||
problems = [(d.strip()) for d in data.split("\\item") if not d.strip() == ""]
|
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:
|
for p in problems:
|
||||||
p_treated = pre_treating(p)
|
p_treated = pre_treating(p)
|
||||||
t = stringmaxsim(p_treated,treated_dict,3)
|
t = stringmaxsim(p_treated,treated_dict,5)
|
||||||
psrstring = ""
|
psrstring = ""
|
||||||
for id,simrate in t:
|
for id,simrate in t:
|
||||||
if simrate == 1:
|
if simrate == 1:
|
||||||
psrstring = "rep"+id
|
psrstring = "rep"+id+","
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
psrstring += id + ","
|
psrstring += id + ","
|
||||||
if psrstring[-1] == ",":
|
if psrstring[-1] == ",":
|
||||||
|
|
@ -26,12 +25,15 @@ for p in problems:
|
||||||
output += f"\\item [{psrstring}] {p}\n\n"
|
output += f"\\item [{psrstring}] {p}\n\n"
|
||||||
count = 0
|
count = 0
|
||||||
for id,simrate in t:
|
for id,simrate in t:
|
||||||
output += "\n\\begin{tcolorbox}"+f"[colback = {colors[count]}!10!white, colframe = orange!10!white, breakable]\n"
|
if simrate > 0.5:
|
||||||
output += f"{simrate:.3f} \\ {id}\n\n"
|
colors = get_color(simrate*2-1)
|
||||||
content = pro_dict[id]["content"]
|
output += "\n\\definecolor{mycolor}{rgb}"+colors
|
||||||
output += f"{content}\n"
|
output += "\n\\begin{tcolorbox}"+f"[colback = mycolor, opacityback = 0.25, colframe = orange!10!white, breakable]\n"
|
||||||
output += "\\end{tcolorbox}\n"
|
output += f"{simrate:.3f} \\ {id}\n\n"
|
||||||
count += 1
|
content = pro_dict[id]["content"]
|
||||||
|
output += f"{content}\n"
|
||||||
|
output += "\\end{tcolorbox}\n"
|
||||||
|
count += 1
|
||||||
output += "\n\n"
|
output += "\n\n"
|
||||||
output += "\n\\end{enumerate}\n\n"
|
output += "\n\\end{enumerate}\n\n"
|
||||||
|
|
||||||
|
|
|
||||||
Reference in New Issue