def fullTest(): res = [] allHitRefs = set() allRefs = set() #TEST totalCount = 0 keep = [] for paperName in os.listdir(DATA_DIR): paper = None try: #TEST totalCount += 1 paper = parser.parseFullDataset(DATA_DIR + '/' + paperName) if not paper: print "Error parsing " + paperName continue #TEST keep.append(paperName) paperRes = normalRun(paper) if paperRes: allHitRefs.update(paperRes[2]) allRefs.update([ ref.title.strip().upper() for ref in paper.references.values()]) res.append((paperRes[0], paperRes[1])) except OSError: print "Error parsing paper: " + paperName continue #TEST print "\n\n------------------------\n\n" print "{} / {}".format(len(keep), totalCount) res = sorted(res, reverse = True) total = 0 for paper in res: print paper[1] total += paper[0] print "Total Papers: {}".format(len(res)) print "Average: {}".format(total / len(res)) if len(res) % 2 == 0: print "Median: {}".format((res[len(res) / 2][0] + res[len(res) / 2 - 1][0]) / 2.0) else: print "Median: {}".format(res[len(res) / 2][0]) print "Hit Refs: {}, All Refs: {}".format(len(allHitRefs), len(allRefs)) print "Foaad Metric: {}".format(float(len(allHitRefs)) / len(allRefs))
def main(): # full test mode if '-f' in sys.argv: fullTest() return #paper = parser.parseFullDataset('data/dynamo') #paperName = '../data/A Bayesian Inference Framework to Reconstruct Transmission Trees Using Epidemiological and Genetic Data' paperName = '../data/A Graphical Modelling Approach to the Dissection of Highly Correlated Transcription Factor Binding Site Profiles' if '-p' in sys.argv: paperName = sys.argv[sys.argv.index('-p') + 1] paper = parser.parseFullDataset(paperName) if not paper: print "Error parsing paper" return print paper # Ordering mode if '-o' in sys.argv: orderingRun(paper) else: debugRun(paper)