We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b05e06f commit 4758149Copy full SHA for 4758149
1 file changed
tests/test_bertcoref.py
@@ -26,3 +26,22 @@ def test_doc_is_reconstructed(
26
27
assert doc.tokens == reconstructed_doc.tokens
28
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)
0 commit comments