diff --git a/spacy/ml/models/coref_util.py b/spacy/ml/models/coref_util.py index 38af629d5..3be0bd835 100644 --- a/spacy/ml/models/coref_util.py +++ b/spacy/ml/models/coref_util.py @@ -205,7 +205,7 @@ def create_gold_scores( return out -def _spans_to_offsets(doc): +def _spans_to_offsets(doc: Doc) -> List[List[Tuple[int, int]]]: """Convert doc.spans to nested list of ints for comparison. The ints are character indices, and the spans groups are sorted by key first. diff --git a/spacy/tests/pipeline/test_span_predictor.py b/spacy/tests/pipeline/test_span_predictor.py index a79756d88..c0e59e914 100644 --- a/spacy/tests/pipeline/test_span_predictor.py +++ b/spacy/tests/pipeline/test_span_predictor.py @@ -154,7 +154,7 @@ def test_tokenization_mismatch(nlp): for key, cluster in ref.spans.items(): char_spans[key] = [] for span in cluster: - char_spans[key].append((span[0].idx, span[-1].idx + len(span[-1]))) + char_spans[key].append((span.start_char, span.end_char)) with ref.retokenize() as retokenizer: # merge "picked up" retokenizer.merge(ref[2:4])