Esempio n. 1
0
def load_imported_data_for_antecedent(fname=AUTO_PARSE_NPY_DATA):
    ac = AntecedentClassifier(0, 14, 15, 19, 20, 24)

    print 'Loading NPY data from this file:', fname

    data = np.load(fname)

    ac.sentences = data[0]
    ac.train_triggers = data[1]
    ac.val_triggers = data[2]
    ac.test_triggers = data[3]

    for i, sentwords in enumerate(data[4]):
        ac.sentences[i].words = sentwords

    return ac
Esempio n. 2
0
def load_imported_data_for_antecedent(fname=AUTO_PARSE_NPY_DATA):
    ac = AntecedentClassifier(0, 14, 15, 19, 20, 24)

    print 'Loading NPY data from this file:',fname

    data = np.load(fname)

    ac.sentences = data[0]
    ac.train_triggers = data[1]
    ac.val_triggers = data[2]
    ac.test_triggers = data[3]

    for i,sentwords in enumerate(data[4]):
        ac.sentences[i].words = sentwords

    return ac
Esempio n. 3
0
    if 'types' in argv:
        ac = None
        if mrg:
            ac = load_imported_data_for_antecedent(
                fname=GOLD_PARSE_FULL_NPY_DATA)

        ac, prediction_list = cross_validate(auto_parse=not mrg,
                                             classifier=ac,
                                             baseline='baseline' in argv)
        results_by_type(ac, prediction_list)
        # log_results(results_lst, fname=results_save)

    if 'ablate' in argv:
        ablation_study(auto_parse=not mrg, exclude=True)

    if 'bos' in argv:
        bos_compare()

    if 'bos_spen' in argv:
        bos_spen_split()

    if 'debug' in argv:
        ac = load_imported_data_for_antecedent(fname=save_file)
        ac.train_triggers = ac.train_triggers[0:2]
        ac.val_triggers = ac.val_triggers[0:2]
        ac.test_triggers = ac.test_triggers[0:2]
        ac.generate_possible_ants(
            ['VP', wc.is_predicative, wc.is_adjective, wc.is_verb])
        ac.build_feature_vectors(debug=True)
Esempio n. 4
0
        save_imported_data_for_antecedent(ac, fname=save_file)

    if 'types' in argv:
        ac = None
        if mrg:
            ac = load_imported_data_for_antecedent(fname=GOLD_PARSE_FULL_NPY_DATA)

        ac, prediction_list = cross_validate(auto_parse=not mrg, classifier=ac, baseline='baseline' in argv)
        results_by_type(ac, prediction_list)
        # log_results(results_lst, fname=results_save)

    if 'ablate' in argv:
        ablation_study(auto_parse=not mrg, exclude=True)

    if 'bos' in argv:
        bos_compare()

    if 'bos_spen' in argv:
        bos_spen_split()

    if 'debug' in argv:
        ac = load_imported_data_for_antecedent(fname=save_file)
        ac.train_triggers = ac.train_triggers[0:2]
        ac.val_triggers = ac.val_triggers[0:2]
        ac.test_triggers = ac.test_triggers[0:2]
        ac.generate_possible_ants(['VP', wc.is_predicative, wc.is_adjective, wc.is_verb])
        ac.build_feature_vectors(debug=True)