Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, config_file):
self.config_file = config_file
self.config = json.loads( open(config_file).read() )
self.Letor07Path = self.config['data_dir'] #'/home/pangliang/matching/data/letor/r5w/'
self.word_dict, self.iword_dict = utils.read_word_dict(
filename=self.Letor07Path + '/word_dict.txt')
self.query_data = utils.read_data(
filename=self.Letor07Path + '/qid_query.txt')
self.doc_data = utils.read_data(
filename=self.Letor07Path + '/docid_doc.txt')
self.embed_dict = utils.read_embedding(
filename=self.Letor07Path + '/embed_wiki-pdc_d50_norm')
self.idf_dict = utils.read_embedding(
filename=self.Letor07Path + '/embed.idf')
self.feat_size = self.config['feat_size']
self._PAD_ = len(self.word_dict)
self.word_dict[self._PAD_] = '[PAD]'
self.iword_dict['[PAD]'] = self._PAD_