Merge branch 'add/exclusive-spancat' of github.com:ljvmiranda921/spaCy into add/exclusive-spancat

This commit is contained in:
Lj Miranda 2022-11-29 11:15:15 +08:00
commit 616723e902
2 changed files with 6 additions and 6 deletions

View File

@ -64,7 +64,7 @@ def make_spancat(
allow_overlap: bool = True,
) -> "Exclusive_SpanCategorizer":
"""Create a SpanCategorizerExclusive component. The span categorizer consists of two
parts: a suggester function that proposes candidate spans, and a labeller
parts: a suggester function that proposes candidate spans, and a labeler
model that predicts a single label for each span.
suggester (Callable[[Iterable[Doc], Optional[Ops]], Ragged]): A function that suggests spans.
@ -81,7 +81,7 @@ def make_spancat(
Scorer.score_spans for the Doc.spans[spans_key] with overlapping
spans allowed.
negative_weight (float): Multiplier for the loss terms.
Can be used to down weigh the negative samples if there are too many.
Can be used to downweight the negative samples if there are too many.
allow_overlap (bool): If True the data is assumed to
contain overlapping spans.
"""
@ -100,7 +100,7 @@ def make_spancat(
@dataclass
class Ranges:
"""
Helper class help avoid storing overlapping span.
Helper class to avoid storing overlapping spans.
"""
def __init__(self):

View File

@ -87,8 +87,8 @@ architectures and their arguments and hyperparameters.
| `threshold` | Minimum probability to consider a prediction positive. Spans with a positive prediction will be saved on the Doc. Defaults to `0.5`. ~~float~~ |
| `max_positive` | Maximum number of labels to consider positive per span. Defaults to `None`, indicating no limit. ~~Optional[int]~~ |
| `scorer` | The scoring method. Defaults to [`Scorer.score_spans`](/api/scorer#score_spans) for `Doc.spans[spans_key]` with overlapping spans allowed. ~~Optional[Callable]~~ |
| `negative_weight` | Multiplier for the loss terms. It can be used to down weigh the negative samples if there are too many. It is only available when using the `spancat_exclusive` component. ~~float~~ |
| `allow_overlap` | If `True`, the data is assumed to contain overlapping spans. It is only available when using the `spancat_exclusive` component. ~~bool~~ |
| `negative_weight` | Multiplier for the loss terms. It can be used to downweight the negative samples if there are too many. It is only available for the `spancat_exclusive` component. ~~float~~ |
| `allow_overlap` | If `True`, the data is assumed to contain overlapping spans. It is only available for the `spancat_exclusive` component. ~~bool~~ |
@ -106,7 +106,7 @@ architectures and their arguments and hyperparameters.
>
> ```python
> # Construction via add_pipe with default model
> # Use 'spancat_exclusive' for exclusive clases
> # Use 'spancat_exclusive' for exclusive classes
> spancat = nlp.add_pipe("spancat")
>
> # Construction via add_pipe with custom model