From 854d1614a924b908a6690fb96995e0e415423b0b Mon Sep 17 00:00:00 2001 From: kadarakos Date: Fri, 3 Mar 2023 15:51:57 +0000 Subject: [PATCH] Intervals to private and document 'name' param --- spacy/pipeline/spancat.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spacy/pipeline/spancat.py b/spacy/pipeline/spancat.py index d6e887218..189c5ae41 100644 --- a/spacy/pipeline/spancat.py +++ b/spacy/pipeline/spancat.py @@ -155,6 +155,8 @@ def make_spancat( parts: a suggester function that proposes candidate spans, and a labeller model that predicts one or more labels for each span. + name (str): The component instance name, used to add entries to the + losses during training. suggester (Callable[[Iterable[Doc], Optional[Ops]], Ragged]): A function that suggests spans. Spans are returned as a ragged array with two integer columns, for the start and end positions. @@ -218,6 +220,8 @@ def make_spancat_singlelabel( parts: a suggester function that proposes candidate spans, and a labeller model that predicts one or more labels for each span. + name (str): The component instance name, used to add entries to the + losses during training. suggester (Callable[[Iterable[Doc], Optional[Ops]], Ragged]): A function that suggests spans. Spans are returned as a ragged array with two integer columns, for the start and end positions. @@ -271,7 +275,7 @@ def make_spancat_scorer(): @dataclass -class Intervals: +class _Intervals: """ Helper class to avoid storing overlapping spans. """ @@ -729,7 +733,7 @@ class SpanCategorizer(TrainablePipe): predicted = predicted[sort_idx] indices = indices[sort_idx] keeps = keeps[sort_idx] - seen = Intervals() + seen = _Intervals() spans = SpanGroup(doc, name=self.key) attrs_scores = [] for i in range(indices.shape[0]):