Beispiel #1
0
def test_match_last_tok_f1_d2_3():
    global all_markables
    f, r, p = coref.eval_on_dataset(
        coref_rules.make_resolver(coref_rules.match_last_token), all_markables)
    assert_greater(f, .64)
    assert_greater(r, .59)
    assert_greater(p, .71)
Beispiel #2
0
def test_match_nopro_f1_d2_3():
    global all_markables
    f, r, p = coref.eval_on_dataset(
        coref_rules.make_resolver(coref_rules.exact_match_no_pronouns),
        all_markables)
    assert_almost_equals(r, 0.3028, places=4)
    assert_almost_equals(p, 0.9158, places=4)
Beispiel #3
0
def test_match_content_f1_d2_5():
    global all_markables
    f, r, p = coref.eval_on_dataset(
        coref_rules.make_resolver(coref_rules.match_on_content), all_markables)
    assert_greater(f, .68)
    assert_greater(r, .57)
    assert_greater(p, .85)
Beispiel #4
0
def test_match_nopro_f1_d2_3():
    global all_markables
    f, r, p = coref.eval_on_dataset(
        coref_rules.make_resolver(coref_rules.exact_match_no_pronouns),
        all_markables)
    assert_almost_equals(r, 0.3028, places=4)
    assert_almost_equals(p, 0.9158, places=4)
Beispiel #5
0
def test_match_no_overlap_f1_d2_4():
    global all_markables
    f,r,p = coref.eval_on_dataset(
        coref_rules.make_resolver(coref_rules.match_last_token_no_overlap),
        all_markables)
    assert_greater(f,.67)
    assert_greater(r,.61)
    assert_greater(p,.74)
Beispiel #6
0
def test_match_no_overlap_f1_d2_4():
    global all_markables
    f,r,p = coref.eval_on_dataset(
        coref_rules.make_resolver(coref_rules.match_last_token_no_overlap),
        all_markables)
    assert_greater(f,.67)
    assert_greater(r,.61)
    assert_greater(p,.74)
Beispiel #7
0
def test_match_content_f1_d2_5():
    global all_markables
    f,r,p = coref.eval_on_dataset(
        coref_rules.make_resolver(coref_rules.match_on_content),
        all_markables)
    assert_greater(f,.68)
    assert_greater(r,.57)
    assert_greater(p,.85)
Beispiel #8
0
def test_match_nopro_f1_d2_2():
    global all_markables
    f, r, p = coref.eval_on_dataset(
        coref_rules.make_resolver(coref_rules.exact_match_no_pronouns),
        all_markables)
    assert_greater(f, .64)
    assert_greater(r, .48)
    assert_greater(p, .94)
Beispiel #9
0
def test_match_last_tok_f1_d2_3():
    global all_markables
    f,r,p = coref.eval_on_dataset(
        coref_rules.make_resolver(coref_rules.match_last_token),
        all_markables)
    assert_greater(f,.64)
    assert_greater(r,.59)
    assert_greater(p,.71)
Beispiel #10
0
def test_match_nopro_f1_d2_2():
    global all_markables
    f,r,p = coref.eval_on_dataset(
        coref_rules.make_resolver(coref_rules.exact_match_no_pronouns),
        all_markables)
    print f,r,p
    case_1 = [.48,.94] 
    case_2 = [.405,.97]
    assert any(r > case[0] and p > case[1] for case in [case_1,case_2])
Beispiel #11
0
def setup_module():
    global markables_dev
    global markables_tr
    global all_markables,all_markables_te,all_markables_dev
    global exact_matcher
    
    markables_dev,_ = coref.read_data('Siege of Chaves',basedir=dev_dir)
    markables_tr,_ = coref.read_data('Johnston Atoll',basedir=tr_dir)
    all_markables,_ = coref.read_dataset(tr_dir,tagger=pos_tag)
    all_markables_te,_ = coref.read_dataset(te_dir)
    all_markables_dev,_ = coref.read_dataset(dev_dir)

    exact_matcher = coref_rules.make_resolver(coref_rules.exact_match)
Beispiel #12
0
def setup_module():
    global markables_dev
    global markables_tr
    global all_markables,all_markables_te,all_markables_dev
    global exact_matcher
    
    markables_dev,_ = coref.read_data('Siege of Chaves',basedir=dev_dir)
    markables_tr,_ = coref.read_data('Johnston Atoll',basedir=tr_dir)
    all_markables,_ = coref.read_dataset(tr_dir,tagger=pos_tag)
    all_markables_te,_ = coref.read_dataset(te_dir)
    all_markables_dev,_ = coref.read_dataset(dev_dir)

    exact_matcher = coref_rules.make_resolver(coref_rules.exact_match)
Beispiel #13
0
def setup_module():
    global markables_dev
    global markables_tr
    global all_markables, all_markables_te, all_markables_dev
    global exact_matcher
    
    markables_tr, _ = coref.read_data('06_wsj_0051.sty', basedir=tr_dir, tagger=pos_tag)
    markables_dev, _ = coref.read_data('25_wsj_0015.sty', basedir=dev_dir, tagger=pos_tag)
    all_markables, _ = coref.read_dataset(tr_dir, tagger=pos_tag)
    all_markables_dev, _ = coref.read_dataset(dev_dir, tagger=pos_tag)
    all_markables_te, _ = coref.read_dataset(te_dir, tagger=pos_tag)

    exact_matcher = coref_rules.make_resolver(coref_rules.exact_match)
Beispiel #14
0
def setup_module():
    global markables_dev
    global markables_tr
    global all_markables, all_markables_te, all_markables_dev
    global exact_matcher

    markables_tr, _ = coref.read_data('06_wsj_0051.sty',
                                      basedir=tr_dir,
                                      tagger=pos_tag)
    markables_dev, _ = coref.read_data('25_wsj_0015.sty',
                                       basedir=dev_dir,
                                       tagger=pos_tag)
    all_markables, _ = coref.read_dataset(tr_dir, tagger=pos_tag)
    all_markables_dev, _ = coref.read_dataset(dev_dir, tagger=pos_tag)
    all_markables_te, _ = coref.read_dataset(te_dir, tagger=pos_tag)

    exact_matcher = coref_rules.make_resolver(coref_rules.exact_match)
Beispiel #15
0
def test_singleton_matcher_d2_2():
    ants = coref_rules.make_resolver(coref_rules.singleton_matcher)(markables_tr)
    assert_equal(len(coref.markables_to_entities(markables_tr, ants)[1]), len(markables_tr))
Beispiel #16
0
def test_full_cluster_matcher_d2_2():
    ants = coref_rules.make_resolver(coref_rules.full_cluster_matcher)(markables_tr)
    assert_equal(len(coref.markables_to_entities(markables_tr, ants)[1]), 1)
Beispiel #17
0
def test_full_cluster_matcher_d2_2():
    ants = coref_rules.make_resolver(
        coref_rules.full_cluster_matcher)(markables_tr)
    assert_equal(len(coref.markables_to_entities(markables_tr, ants)[1]), 1)
Beispiel #18
0
def test_singleton_matcher_d2_2():
    ants = coref_rules.make_resolver(
        coref_rules.singleton_matcher)(markables_tr)
    assert_equal(len(coref.markables_to_entities(markables_tr, ants)[1]),
                 len(markables_tr))