def learnAnswer(trial, answer): (id, solution, ordering, src, dest, desc, verification) = answer srcnode = database.getNode(src) dstnode = database.getNode(dest) matches = database.searchVerificationMatch(trial, src, dest, desc) if len(matches) == 1: match = matches[0] print("\t%s --- %s --> %s was automatically verified." % (srcnode[2], desc, dstnode[2])) database.setVerification(id, match["verification"]) return elif len(matches) > 1: print("\t%s --- %s --> %s" % (srcnode[2], desc, dstnode[2])) print( "\tThe following candidates may be used for semiautomatic verification:" ) print("\t\t0: None of them") answers = [] n = 1 for match in matches: answers.append(match["verification"]) print("\t\t%d: %s --- %s --> %s (%s)" % (n, srcnode[2], match["description"], dstnode[2], ", ".join( database.unpackVerification(match["verification"])))) n += 1 while True: res = input("> ") if res.isdigit(): res = int(res) if res == 0: break elif res > 0 and res < n: database.setVerification(id, answers[res - 1]) return flags = [] for flag in database.listVerifications(): while True: print("Is this answer %s correct? (Y/N)" % flag) print("\t%s --- %s --> %s" % (srcnode[2], desc, dstnode[2])) res = input("> ") if res in ["y", "Y"]: flags.append(flag) break elif res in ["n", "N"]: break else: print("Your input was invalid. Try again.") database.setVerification(id, database.packVerification(flags))
"edgeCount": ("Edge Usage Count", collectEdgeUsedCounts, {}), "edgeCorrect": ("Edge Correct", collectEdgeCorrect, {"verification": 6}), }, "nodes": {}, "verification": {} } for t in [None, "Vorher", "Nachher"]: for m in [None, "Video", "Text"]: ts = "" if t == None else t ms = "" if m == None else m stats["nodes"].update({ "nodeUsageCount%s_%s" % (ts,ms): ("Node Usage Count %s %s" % (ts,ms), collectNodeUsedCounts, {"timing": t, "medium": m}), "nodeUsagePlot%s_%s" % (ts,ms): ("Node Usage Plot %s %s" % (ts,ms), collectNodeUsagePlot, {"timing": t, "medium": m}), }) for v in [30]: vs = "" if v == None else ",".join(database.unpackVerification(v)) args = {"timing": t, "medium": m, "verification": v} stats["nodes"].update({ "nodeUsageCount%s_%s_%s" % (ts,ms,str(v)): ("Node Usage Count %s %s %s" % (ts,ms,vs), collectNodeUsedCounts, args), "nodeUsagePlot%s_%s_%s" % (ts,ms,str(v)): ("Node Usage Plot %s %s %s" % (ts,ms,vs), collectNodeUsagePlot, args), }) stats["edges"].update({ "edgeCorrect%s_%s_%s" % (ts,ms,str(v)): ("Edge Correct %s %s %s" % (ts,ms,vs), collectEdgeCorrect, args), }) # Supported statistics output: # - listing: a list of records # Arguments: names, records # names: a list of captions for the columns # records: a list of iterables that represent the rows # - table: a table with arbitrary rows and columns
def learnAnswer(trial, answer): (id,solution,ordering,src,dest,desc,verification) = answer srcnode = database.getNode(src) dstnode = database.getNode(dest) matches = database.searchVerificationMatch(trial, src, dest, desc) if len(matches) == 1: match = matches[0] print("\t%s --- %s --> %s was automatically verified." % (srcnode[2],desc,dstnode[2])) database.setVerification(id, match["verification"]) return elif len(matches) > 1: print("\t%s --- %s --> %s" % (srcnode[2],desc,dstnode[2])) print("\tThe following candidates may be used for semiautomatic verification:") print("\t\t0: None of them") answers = [] n = 1 for match in matches: answers.append(match["verification"]) print("\t\t%d: %s --- %s --> %s (%s)" % (n,srcnode[2],match["description"],dstnode[2],", ".join(database.unpackVerification(match["verification"])))) n += 1 while True: res = input("> ") if res.isdigit(): res = int(res) if res == 0: break elif res > 0 and res < n: database.setVerification(id, answers[res-1]) return flags = [] for flag in database.listVerifications(): while True: print("Is this answer %s correct? (Y/N)" % flag) print("\t%s --- %s --> %s" % (srcnode[2],desc,dstnode[2])) res = input("> ") if res in ["y", "Y"]: flags.append(flag) break elif res in ["n", "N"]: break else: print("Your input was invalid. Try again.") database.setVerification(id, database.packVerification(flags))
ts = "" if t == None else t ms = "" if m == None else m stats["nodes"].update({ "nodeUsageCount%s_%s" % (ts, ms): ("Node Usage Count %s %s" % (ts, ms), collectNodeUsedCounts, { "timing": t, "medium": m }), "nodeUsagePlot%s_%s" % (ts, ms): ("Node Usage Plot %s %s" % (ts, ms), collectNodeUsagePlot, { "timing": t, "medium": m }), }) for v in [30]: vs = "" if v == None else ",".join(database.unpackVerification(v)) args = {"timing": t, "medium": m, "verification": v} stats["nodes"].update({ "nodeUsageCount%s_%s_%s" % (ts, ms, str(v)): ("Node Usage Count %s %s %s" % (ts, ms, vs), collectNodeUsedCounts, args), "nodeUsagePlot%s_%s_%s" % (ts, ms, str(v)): ("Node Usage Plot %s %s %s" % (ts, ms, vs), collectNodeUsagePlot, args), }) stats["edges"].update({ "edgeCorrect%s_%s_%s" % (ts, ms, str(v)): ("Edge Correct %s %s %s" % (ts, ms, vs), collectEdgeCorrect, args), })