original_id_list = "1:50000"
suffix_words = ["试题",r"第[\d]*题"]
outputfilepath = "临时文件/分类题号列表.json"

from database_tools import *

pro_dict = load_dict("../题库0.3/problems.json")
idlist =  generate_number_set(original_id_list,pro_dict)

#记录每一个出处对应的题号列表
setlist = {}
for id in idlist:
    p = pro_dict[id]["origin"]
    origin = StripSuffix(p,suffix_words)
    if not origin in setlist:
        setlist[origin] = [id]
    else:
        setlist[origin].append(id)

outputdict = {}
for origin in setlist:
    outputdict[origin] = generate_exp(setlist[origin])

save_dict(outputdict,outputfilepath)
print("已将结果输出至 %s"%outputfilepath)