コード例 #1
0
def test_eid_rule1_incorrect():
    curator = LiveCurator(corpora={'1': _make_corpus()})
    curator.submit_curation(corpus_id='1', curations={'1': 0})
    expected = {'1': 0, '2': 0.8942, '3': 0.957125, '4': 0.65, '5': 0.65}
    beliefs = curator.update_beliefs(corpus_id='1')
    assert close_enough(beliefs, expected), (beliefs, expected)

    # Submit another curation
    curator.submit_curation(corpus_id='1', curations={'1': 0})
    expected = {'1': 0, '2': 0.8917, '3': 0.957125, '4': 0.65, '5': 0.65}
    beliefs = curator.update_beliefs(corpus_id='1')
    assert close_enough(beliefs, expected), (beliefs, expected)
コード例 #2
0
def test_sofia_incorrect():
    curator = LiveCurator(corpora={'1': _make_corpus()})
    curator.submit_curation(corpus_id='1', curations={'4': 0})
    expected = {
        '1': 0.91675,
        '2': 0.89684,
        '3': 0.9533,
        '4': 0.0,
        '5': 0.61904
    }
    beliefs = curator.update_beliefs(corpus_id='1')
    assert close_enough(beliefs, expected), (beliefs, expected)

    curator.submit_curation(corpus_id='1', curations={'5': 0})
    expected = {'1': 0.91675, '2': 0.89684, '3': 0.9533, '4': 0, '5': 0}
    beliefs = curator.update_beliefs(corpus_id='1')
    assert close_enough(beliefs, expected), (beliefs, expected)
コード例 #3
0
def test_hume_incorrect():
    curator = LiveCurator(corpora={'1': _make_corpus()})
    curator.submit_curation(corpus_id='1', curations={'3': 0})
    expected = {'1': 0.91675,
                '2': 0.88772,
                '3': 0,
                '4': 0.61904,
                '5': 0.61904}
    beliefs = curator.update_beliefs(corpus_id='1')
    assert close_enough(beliefs, expected), (beliefs, expected)
コード例 #4
0
def test_eid_rule2_correct():
    curator = LiveCurator(corpora={'1': _make_corpus()})
    curator.submit_curation(corpus_id='1', curations={'2': 1})
    expected = {'1': 0.91717,
                '2': 1,
                '3': 0.95916,
                '4': 0.65,
                '5': 0.65}
    beliefs = curator.update_beliefs(corpus_id='1')
    assert close_enough(beliefs, expected), (beliefs, expected)
コード例 #5
0
def test_no_curation():
    curator = LiveCurator(corpora={'1': _make_corpus()})
    curator.submit_curation(corpus_id='1', curations={})
    beliefs = curator.update_beliefs(corpus_id='1')
    expected = {'1': 0.91675,
                '2': 0.8968,
                '3': 0.957125,
                '4': 0.65,
                '5': 0.65}
    assert close_enough(beliefs, expected), (beliefs, expected)
コード例 #6
0
def test_eid_rule2_correct():
    curator = LiveCurator(corpora={'1': _make_corpus()})
    curator.submit_curation(corpus_id='1', curations={'2': 1})
    expected = {'1': 0.91717,
                '2': 1,
                '3': 0.95916,
                '4': 0.65,
                '5': 0.65}
    beliefs = curator.update_beliefs(corpus_id='1')
    assert close_enough(beliefs, expected), (beliefs, expected)
コード例 #7
0
def test_no_curation():
    curator = LiveCurator(corpora={'1': _make_corpus()})
    curator.submit_curation(corpus_id='1', curations={})
    beliefs = curator.update_beliefs(corpus_id='1')
    expected = {'1': 0.91675,
                '2': 0.8968,
                '3': 0.957125,
                '4': 0.65,
                '5': 0.65}
    assert close_enough(beliefs, expected), (beliefs, expected)
コード例 #8
0
def test_eid_rule1_incorrect():
    curator = LiveCurator(corpora={'1': _make_corpus()})
    curator.submit_curation(corpus_id='1', curations={'1': 0})
    expected = {'1': 0,
                '2': 0.8942,
                '3': 0.957125,
                '4': 0.65,
                '5': 0.65}
    beliefs = curator.update_beliefs(corpus_id='1')
    assert close_enough(beliefs, expected), (beliefs, expected)

    # Submit another curation
    curator.submit_curation(corpus_id='1', curations={'1': 0})
    expected = {'1': 0,
                '2': 0.8917,
                '3': 0.957125,
                '4': 0.65,
                '5': 0.65}
    beliefs = curator.update_beliefs(corpus_id='1')
    assert close_enough(beliefs, expected), (beliefs, expected)