35 lines
1.5 KiB
Python
35 lines
1.5 KiB
Python
keywords_dict = {
|
|
"id":[""], #题号
|
|
"content":[""], #题面内容
|
|
"objs":[""], #目标代码
|
|
"tags":[""], #标签, 如["第二单元"]等
|
|
"genre":[""], #题目类型, 填空题, 选择题, 解答题
|
|
"ans":[r""], #答案
|
|
"solution":[""], #解答与提示
|
|
"duration":[""], #解题时间(目前未设置)
|
|
"usages":[""], #使用记录, 数据库中格式为 <日期>\t<届别><班别>\t正确率[\t正确率]... 例如"20230301\t2023届01班\t0.985\t0.211
|
|
"origin":[""], #题目来源
|
|
"edit":[""], #导入者及编辑者
|
|
"same":[""], #相同题目题号
|
|
"related":[""], #关联题目题号
|
|
"remark":[""], #备注, 注记
|
|
"space":[""], #解答题下的空间(em)表示一个m的宽度
|
|
"unrelated":[""], #无关题目题号
|
|
# "content2":["双曲线"], #在字段名中加入数字表示这个字段的另一个必要条件
|
|
}
|
|
#同一字段名中的条件为"或"的关系, 不同字段名(可加数字表示同一字段)中的条件为"且"的关系
|
|
outputfilepath = "临时文件/题号筛选.txt"
|
|
|
|
from database_tools import *
|
|
|
|
prodictpath = "../题库0.3/Problems.json"
|
|
pro_dict = load_dict(prodictpath)
|
|
|
|
|
|
keywords_dict["content9_not"] = ["OBSOLETE"]
|
|
print(keywords_dict)
|
|
matchlist = [id for id in pro_dict if MatchCondition(pro_dict[id],keywords_dict)]
|
|
matchstring = generate_exp(matchlist)
|
|
|
|
SaveTextFile(matchstring,outputfilepath)
|
|
os.system("code -g %s:1"%outputfilepath) |