Example #1
0
def test_windowdiff_extra_boundary():
    reference_labels = [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]]
    computed_labels = [[1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]]
    result = windowdiff(reference_labels, computed_labels, window_size=3)
    assert result == 0.1
    if 'nltk' in sys.modules:
        result = nltk_windowdiff(to_boundaries(reference_labels[0]),
                                 to_boundaries(computed_labels[0]), 2)
        assert result == 0.1
Example #2
0
def test_windowdiff_empty():
    reference_labels = [[]]
    computed_labels = [[]]
    with pytest.raises(ZeroDivisionError):
        result = windowdiff(reference_labels, computed_labels, window_size=3)