def conn_connCtx(arg_clauses, clause_index, parse_dict): # load dict dict_conn_connCtx = Ps_arg2_dict().dict_conn_connCtx # feature conn_connCtx = dict_util.get_conn_connCtx(arg_clauses, clause_index, parse_dict) return get_feature_by_feat(dict_conn_connCtx, conn_connCtx)
def conn_curr_first(arg_clauses, clause_index, parse_dict): # load dict dict_conn_curr_first = Ps_arg2_dict().dict_conn_curr_first # feature conn_curr_first = dict_util.get_conn_curr_first(arg_clauses, clause_index, parse_dict) return get_feature_by_feat(dict_conn_curr_first, conn_curr_first)
def con_lstr(arg_clauses, clause_index, parse_dict): # load dict dict_con_lstr = Ps_arg2_dict().dict_con_lstr con_lstr = dict_util.get_con_lstr(arg_clauses, clause_index, parse_dict) return get_feature_by_feat(dict_con_lstr, con_lstr)
def curr_first_prev_last_parse_path(arg_clauses, clause_index, parse_dict): # load dict dict_curr_first_prev_last_parse_path = Ps_arg2_dict().dict_curr_first_prev_last_parse_path # feature curr_first_prev_last_parse_path = dict_util.get_curr_first_prev_last_parse_path(arg_clauses, clause_index, parse_dict) return get_feature_by_feat(dict_curr_first_prev_last_parse_path, curr_first_prev_last_parse_path)
def prev_last(arg_clauses, clause_index, parse_dict): # load dict dict_prev_last = Ps_arg2_dict().dict_prev_last prev_last = dict_util.get_prev_last(arg_clauses, clause_index, parse_dict) return get_feature_by_feat(dict_prev_last, prev_last)
def conn_to_root_compressed_path(arg_clauses, clause_index, parse_dict): # load dict dict_conn_to_root_compressed_path = Ps_arg2_dict().dict_conn_to_root_compressed_path conn_to_root_compressed_path = dict_util.get_conn_to_root_compressed_path(arg_clauses, clause_index, parse_dict) return get_feature_by_feat(dict_conn_to_root_compressed_path, conn_to_root_compressed_path)
def production_rule_list(arg_clauses, clause_index, parse_dict): # load dict dict_curr_production_rule = Ps_arg2_dict().dict_curr_production_rule production_rule_list = dict_util.get_curr_production_rule(arg_clauses, clause_index, parse_dict) return get_feature_by_feat_list(dict_curr_production_rule, production_rule_list)
def curr_last_next_first(arg_clauses, clause_index, parse_dict): # load dict dict_curr_last_next_first = Ps_arg2_dict().dict_curr_last_next_first curr_last_next_first = dict_util.get_curr_last_next_first(arg_clauses, clause_index, parse_dict) return get_feature_by_feat(dict_curr_last_next_first, curr_last_next_first)
def first_lemma_verb(arg_clauses, clause_index, parse_dict): # load dict dict_first_lemma_verb = Ps_arg2_dict().dict_curr_first_lemma_verb # feature first_lemma_verb = dict_util.get_curr_first_lemma_verb(arg_clauses, clause_index, parse_dict) return get_feature_by_feat(dict_first_lemma_verb, first_lemma_verb)
def lemma_verbs(arg_clauses, clause_index, parse_dict): # load dict dict_lemma_verbs = Ps_arg2_dict().dict_lemma_verbs # feature lemma_verbs_list = dict_util.get_curr_lemma_verbs(arg_clauses, clause_index, parse_dict) return get_feature_by_feat_list(dict_lemma_verbs, lemma_verbs_list)
def CParent_to_root_path_node_names(arg_clauses, clause_index, parse_dict): # load dict dict_CParent_to_root_path_node_names = Ps_arg2_dict( ).dict_CParent_to_root_path_node_names # feature CParent_to_root_path_node_names = dict_util.get_CParent_to_root_path_node_names( arg_clauses, clause_index, parse_dict) return get_feature_by_feat_list(dict_CParent_to_root_path_node_names, CParent_to_root_path_node_names)
def _all_features(arg_clauses, clause_index, parse_dict): # load dict dict_lowercase_verbs = Ps_arg2_dict().dict_lowercase_verbs dict_lemma_verbs = Ps_arg2_dict().dict_lemma_verbs dict_curr_first = Ps_arg2_dict().dict_curr_first dict_curr_last = Ps_arg2_dict().dict_curr_last dict_prev_last = Ps_arg2_dict().dict_prev_last dict_next_first = Ps_arg2_dict().dict_next_first dict_prev_last_curr_first = Ps_arg2_dict().dict_prev_last_curr_first dict_curr_last_next_first = Ps_arg2_dict().dict_curr_last_next_first dict_curr_production_rule = Ps_arg2_dict().dict_curr_production_rule dict_position = {"left": 1, "middle": 2, "right": 3} ''' mine ''' dict_con_str = Ps_arg2_dict().dict_con_str dict_con_lstr = Ps_arg2_dict().dict_con_lstr dict_con_cat = {"subordinator": 1, "coordinator": 2, "adverbial": 3} dict_conn_to_root_path = Ps_arg2_dict().dict_conn_to_root_path dict_conn_to_root_compressed_path = Ps_arg2_dict( ).dict_conn_to_root_compressed_path dict_conn_position = Ps_arg2_dict().dict_conn_position # feature lowercase_verbs_list = dict_util.get_curr_lowercased_verbs( arg_clauses, clause_index, parse_dict) lemma_verbs_list = dict_util.get_curr_lemma_verbs(arg_clauses, clause_index, parse_dict) curr_first = dict_util.get_curr_first(arg_clauses, clause_index, parse_dict) curr_last = dict_util.get_curr_last(arg_clauses, clause_index, parse_dict) prev_last = dict_util.get_prev_last(arg_clauses, clause_index, parse_dict) next_first = dict_util.get_next_first(arg_clauses, clause_index, parse_dict) prev_last_curr_first = "%s_%s" % (prev_last, curr_first) curr_last_next_first = "%s_%s" % (curr_last, next_first) # the position of the current clause position = dict_util.get_curr_position(arg_clauses, clause_index, parse_dict) production_rule_list = dict_util.get_curr_production_rule( arg_clauses, clause_index, parse_dict) ''' mine ''' con_str = dict_util.get_con_str(arg_clauses, clause_index, parse_dict) con_lstr = dict_util.get_con_lstr(arg_clauses, clause_index, parse_dict) con_cat = dict_util.get_con_cat(arg_clauses, clause_index, parse_dict) conn_to_root_path = dict_util.get_conn_to_root_path( arg_clauses, clause_index, parse_dict) conn_to_root_compressed_path = dict_util.get_conn_to_root_compressed_path( arg_clauses, clause_index, parse_dict) conn_position = dict_util.get_conn_position(arg_clauses, clause_index, parse_dict) features = [] features.append( get_feature_by_feat_list(dict_lowercase_verbs, lowercase_verbs_list)) features.append( get_feature_by_feat_list(dict_lemma_verbs, lemma_verbs_list)) features.append(get_feature_by_feat(dict_curr_first, curr_first)) features.append(get_feature_by_feat(dict_curr_last, curr_last)) features.append(get_feature_by_feat(dict_prev_last, prev_last)) features.append(get_feature_by_feat(dict_next_first, next_first)) features.append( get_feature_by_feat(dict_prev_last_curr_first, prev_last_curr_first)) features.append( get_feature_by_feat(dict_curr_last_next_first, curr_last_next_first)) features.append(get_feature_by_feat(dict_position, position)) ''' production rules ''' features.append( get_feature_by_feat_list(dict_curr_production_rule, production_rule_list)) ''' mine ''' features.append(get_feature_by_feat(dict_con_str, con_str)) features.append(get_feature_by_feat(dict_con_lstr, con_lstr)) features.append(get_feature_by_feat(dict_con_cat, con_cat)) features.append( get_feature_by_feat(dict_conn_to_root_path, conn_to_root_path)) features.append( get_feature_by_feat(dict_conn_to_root_compressed_path, conn_to_root_compressed_path)) features.append(get_feature_by_feat(dict_conn_position, conn_position)) return util.mergeFeatures(features)
def CPOS(arg_clauses, clause_index, parse_dict): # load dict dict_CPOS = Ps_arg2_dict().dict_CPOS # feature CPOS = dict_util.get_CPOS(arg_clauses, clause_index, parse_dict) return get_feature_by_feat(dict_CPOS, CPOS)
def conn_position(arg_clauses, clause_index, parse_dict): dict_conn_position = Ps_arg2_dict().dict_conn_position conn_position = dict_util.get_conn_position(arg_clauses, clause_index, parse_dict) return get_feature_by_feat(dict_conn_position, conn_position)