Parser of berki style problems and generator of latex file
Samo Penic
2018-11-14 1ee608a7c34c6e526fb67f4c50b819815b09be5b
commit | author | age
c9c8d5 1 from aoi_gen.BerkiParse import BerkiParse
SP 2 from aoi_gen.Problem import ProblemSource, Problem
3 from aoi_gen.Exam import Exam
5aa5bb 4
7c2a8f 5
SP 6 if __name__ == "__main__":
7224af 7     # from glob import glob
SP 8     #
9     # # THIS IS TO BE READ FROM THE DATABASE
10     # filelist = glob("testcases/*")
11     # naloge = []
12     # for i, f in enumerate(filelist):
13     #     with open(f) as fd:
14     #         cont = fd.read()
15     #     naloge.append((i, cont))
16     # source=[]
17     # for nal in naloge:
18     #     par=BerkiParse(nal[1])
19     #     par.parseSections()
20     #     source.append(ProblemSource(parser=par))
78d798 21
5aa5bb 22     settings = {
SP 23         'exam_title': "Naslov izpita",
24         'date': "27.10.2018",
25         'faculty_name': "Fakulteta test",
26         'faculty_id': 0,
27         'exam_id': 0,
28         'last_line': "Empty line",
29         'start_number': 100,
30         'sid_prefill': "11x0xxxx", }
993a25 31
7224af 32     student_list=[
SP 33         ("64990162", "Samo Penic"),
34     ]
5aa5bb 35
7224af 36     exam=Exam(settings=settings, student_list=student_list, number_of_papers=5)
SP 37     exam.loadProblemsFromDirectory("testcases/*.txt")
38     exam.generatePapers()
39     text=exam.exam_to_template()
40     #print(text)
41     exam_matrix=exam.get_answers()
42     print(exam_matrix)
993a25 43     with open('preverjanje.tex','w') as problem_fd:
SP 44         problem_fd.write(text)