Skip to content
Snippets Groups Projects
Commit e5e4b5d2 authored by Blanche Miret's avatar Blanche Miret Committed by Bastien Abadie
Browse files

Build nerval v1

parent fb874bf2
No related branches found
No related tags found
1 merge request!1Build nerval v1
G*rard B-PER
de I-PER
*N*erval I-PER
bo*rn O
in O
Paris B-***
in O
1833 B-DAT
*. O
import pytest
from nerval import evaluate
FAKE_ANNOT_BIO = "test_annot.bio"
FAKE_PREDICT_BIO = "test_predict.bio"
expected_scores = {
'***': {'P': 0.0, 'R': None, 'F1': None},
'DAT': {'P': 0.0, 'R': 0.0, 'F1': 0},
'All': {'P': 0.3333333333333333, 'R': 0.3333333333333333, 'F1': 0.3333333333333333},
'PER': {'P': 1.0, 'R': 1.0, 'F1': 1.0},
'LOC': {'P': None, 'R': 0.0, 'F1': None}
}
@pytest.mark.parametrize("test_input, expected",
[((FAKE_ANNOT_BIO, FAKE_PREDICT_BIO), expected_scores)]
)
def test_run(test_input, expected) :
assert evaluate.run(*test_input) == expected
def test_run_empty_bio() :
with pytest.raises(Exception) :
evaluate.run(EMPTY_BIO, EMPTY_BIO)
def test_run_empty_entry() :
with pytest.raises(TypeError) :
evaluate.run(None, None)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment