File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -26,3 +26,22 @@ def test_doc_is_reconstructed(
2626
2727 assert doc .tokens == reconstructed_doc .tokens
2828 assert doc .coref_chains == reconstructed_doc .coref_chains
29+
30+
31+ @given (doc = coref_docs ())
32+ def test_mention_labels_number_is_correct (doc : CoreferenceDocument ):
33+ """
34+ The number of mentions labeled as such by
35+ :meth:`CoreferenceDocument.mention_labels` should be equal to the
36+ number of mentions of the document (that have a length lower then
37+ `max_span_size`)
38+ """
39+ max_span_size = min (4 , len (doc ))
40+ mentions = [
41+ mention
42+ for chain in doc .coref_chains
43+ for mention in chain
44+ if len (mention .tokens ) <= max_span_size
45+ ]
46+ labels = doc .mention_labels (max_span_size )
47+ assert sum (labels ) == len (mentions )
You can’t perform that action at this time.
0 commit comments