Пример #1
0
 def __init__(self, ref_file_path):
     old_gs = old_read_gs(ref_file_path)
     gs = read_gs(ref_file_path)
     old_filelist = old_gs.keys()
     filelist = gs.keys()
     list_check_equality("gold_standard", old_filelist, filelist)
     for filename in filelist:
         dict_check_equality(filename, old_gs, gs)
Пример #2
0
     relscore = re.split("_", relscore_type)
     k1 = 1.2
     b = 0.75
     if len(relscore) > 4:
         k1 = relscore[3]
         b = relscore[4]
     ft1 = RelscoreFunctionalTest(
         text_dict, data_set_name, relscore[0], int(relscore[1]), int(relscore[2]), float(k1), float(b)
     )
 # check equality of two methods of getting keyphrase_candidate
 for relscore_type in settings["relscore"]:
     for winsize in settings["winsize"]:
         print "relscore_type : %s, winsize : %s" % (relscore_type, winsize)
         old_eval_score = dict()
         refactor_eval_score = dict()
         old_gs = old_read_gs("/Users/KimKR/Desktop/NEXT_LAB/keyword/gold_standard/%s.ref" % (data_set_name))
         refactor_gs = read_gs("/Users/KimKR/Desktop/NEXT_LAB/keyword/gold_standard/%s.ref" % (data_set_name))
         for file_name in text_dict.keys():
             sentences = text_dict[file_name]
             old_relscore = read_relscore(
                 ("/Users/KimKR/Desktop/NEXT_LAB/keyword/rel_score/%s/%s" % (settings["dataset"], relscore_type)),
                 file_name,
             )
             refact_relscore = read_relscore("/Users/KimKR/Desktop/NEXT_LAB/keyword/relScore", file_name)
             # check equality of keyphrase_candidates
             ft = GraphFunctionalTest(file_name, sentences, old_relscore, refact_relscore, int(winsize))
             #                old_gs[file_name] = old_check_gold_standard(sentences, old_gs[file_name])
             #                refactor_gs[file_name] = check_gold_standard(sentences, refactor_gs[file_name])
             old_eval_score[file_name] = evaluate(ft.kokako_graph.score_candidates(), old_gs[file_name])
             refactor_eval_score[file_name] = evaluate(
                 ft.refactored_graph.score_candidates(1, ft.lamb), refactor_gs[file_name]