Ejemplo n.º 1
0
 def process_dataset(self, name):
     data = FileIO.read_list_file(name)
     new_data = []
     for d in data:
         d_list = d.split("\t")
         new_data.append("\t".join([d_list[0], d_list[1], d_list[2]]))
     FileIO.save_list_file("eval-datasets/lexical/7.txt", new_data)
Ejemplo n.º 2
0
 def __init__(self):
     self.dataset = FileIO.read_json_file("sematch/benchmark-data/data.txt")
     self.results = FileIO.read_list_file("sematch/benchmark-data/result.txt")
     self.queries = [(d['query'],d['entity']) for d in self.dataset]
     self.relevants = [d['result'] for d in self.dataset]
     self.synsetExpansion = SynsetExpansion()
     self.engine = Engine()
     self.sims = ['wup', 'lch', 'res','jcn', 'lin']
     self.thresholds = [0.9,1]
     self.gpcs = ['gpc1', 'gpc2', 'gpc3', 'gpc4', 'gpc5', 'gpc6']
Ejemplo n.º 3
0
 def load_dataset(self, dataset_id):
     data = FileIO.read_list_file("eval-datasets/lexical/%s.txt" % dataset_id)
     word_pairs = map(lambda x: (x.split()[0], x.split()[1]), data)
     human = [d.split()[2] for d in data]
     return word_pairs, human