def calculate_selectional_preferences(config_path, model_path, list_preds, vob, output): ''' :param config_path: :param model_path: :param list_preds: :param vob: dictionary with key of preds, values are list of words :param output: :return: ''' cfg = read_config(config_path) mdl, fm1, fm2 = loadSemLM21(model_path, cfg['train'], cfg['valid'], cfg['we_dict1'], cfg['we_dict2'], cfg['dep'], cfg['hidden_size1'], cfg['hidden_size2'], cfg['batch_size'], cfg['save_folder']) for p in list_preds: scores = get_probability_is_argument(mdl, fm1, fm2, p) process_probability(fm1, fm2, scores, p, output + "/" + p + ".out.txt", vobs=vob[p])
def trainModel11(config_path): cfg = read_config(config_path) trainSemLM11(cfg['train'], cfg['valid'], cfg['we_dict'], cfg['dep'], cfg['hidden_size'], cfg['batch_size'], cfg['save_folder'], load_dt=cfg['load_data'])
def calculate_selectional_preferences(config_path, model_path, list_preds, vob, output): cfg = read_config(config_path) mdl, fm = loadSemLM11(model_path, cfg['train'], cfg['valid'], cfg['we_dict'], cfg['dep'], cfg['hidden_size'], cfg['batch_size'], cfg['save_folder']) for p in list_preds: scores = get_probability_is_argument(mdl, fm, p) process_probability(fm, scores, p, output + "/" + p + ".out.txt", vobs=vob[p])