def to_file(question_ids, answers, filename = "output.txt"): """ Uses submit.py to format answers and writes to a file question_ids : int list of question ids corresponding to answers answers : string list of answer text filename : filename to write output """ fh = open(filename, 'w') f_contents = submit.formatAnswers(question_ids, answers) fh.write(f_contents) fh.close()
def run_baseline(write_to_file = "", send_to_scorer = ""): """ Run get_answers and do something with them. write_to_file : if this is not "", then set it to a filename and it will write to it send_to_scorer : string of your netid, submit this to the 4740 scorer website """ q, a = get_answer(first=201) out = submit.formatAnswers(q, a) print out print "===============" if(len(send_to_scorer) > 0): print submit.submit(send_to_scorer, out) if(len(write_to_file) > 0): to_file(q, a, write_to_file) print "Written to " + write_to_file