关键字筛选题号.py中关键字列表留空, OBSOLETE放入到了程序部分

This commit is contained in:
weiye.wang 2024-02-09 13:43:34 +08:00
parent 494efafa5c
commit ebfa3c4d6a
1 changed files with 5 additions and 3 deletions

View File

@ -1,10 +1,10 @@
keywords_dict = { keywords_dict = {
"id":[""], #题号 "id":[""], #题号
"content":["导数"], #题面内容 "content":[""], #题面内容
"objs":[""], #目标代码 "objs":[""], #目标代码
"tags":[""], #标签, 如["第二单元"]等 "tags":[""], #标签, 如["第二单元"]等
"genre":[""], #题目类型, 填空题, 选择题, 解答题 "genre":[""], #题目类型, 填空题, 选择题, 解答题
"ans":[""], #答案 "ans":[r""], #答案
"solution":[""], #解答与提示 "solution":[""], #解答与提示
"duration":[""], #解题时间(目前未设置) "duration":[""], #解题时间(目前未设置)
"usages":[""], #使用记录, 数据库中格式为 <日期>\t<届别><班别>\t正确率[\t正确率]... 例如"20230301\t2023届01班\t0.985\t0.211 "usages":[""], #使用记录, 数据库中格式为 <日期>\t<届别><班别>\t正确率[\t正确率]... 例如"20230301\t2023届01班\t0.985\t0.211
@ -16,7 +16,6 @@ keywords_dict = {
"space":[""], #解答题下的空间(em)表示一个m的宽度 "space":[""], #解答题下的空间(em)表示一个m的宽度
"unrelated":[""], #无关题目题号 "unrelated":[""], #无关题目题号
# "content2":["双曲线"], #在字段名中加入数字表示这个字段的另一个必要条件 # "content2":["双曲线"], #在字段名中加入数字表示这个字段的另一个必要条件
"content_not":["OBSOLETE"], #加_not表示不能出现该样式的词
} }
#同一字段名中的条件为"或"的关系, 不同字段名(可加数字表示同一字段)中的条件为"且"的关系 #同一字段名中的条件为"或"的关系, 不同字段名(可加数字表示同一字段)中的条件为"且"的关系
outputfilepath = "临时文件/题号筛选.txt" outputfilepath = "临时文件/题号筛选.txt"
@ -26,6 +25,9 @@ from database_tools import *
prodictpath = "../题库0.3/problems.json" prodictpath = "../题库0.3/problems.json"
pro_dict = load_dict(prodictpath) 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)] matchlist = [id for id in pro_dict if MatchCondition(pro_dict[id],keywords_dict)]
matchstring = generate_exp(matchlist) matchstring = generate_exp(matchlist)