import sys import json import os from collections import defaultdict from entity_align.utils.Config import Config if __name__ == "__main__": file_of_scores = sys.argv[1] only_best = True if len(sys.argv) > 2 and sys.argv[2] == "True" else False score_objs = [] with open(file_of_scores, 'r') as fin: for line in fin: js = json.loads(line.strip()) c = Config() c.__dict__ = js['config'] js['config'] = c score_objs.append(js) for js in score_objs: print("{}\t{}\t{}\t{}".format(js['config'].model_name, js['config'].dataset_name, "MAP", js['map'])) print("{}\t{}\t{}\t{}".format(js['config'].model_name, js['config'].dataset_name, "HITS@1", js['hits_at_1'])) print("{}\t{}\t{}\t{}".format(js['config'].model_name, js['config'].dataset_name, "HITS@10", js['hits_at_10'])) print("{}\t{}\t{}\t{}".format(js['config'].model_name, js['config'].dataset_name, "HITS@50", js['hits_at_50']))
def copy_config(self): c = Config() c.__dict__ = self.__dict__.copy() return c