mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 08:12:24 +03:00
rename
This commit is contained in:
parent
58f1aa29a0
commit
1796cf3b2b
|
@ -11,7 +11,7 @@ from spacy.tokens import Doc
|
||||||
from spacy.training import Example
|
from spacy.training import Example
|
||||||
|
|
||||||
from ..util import registry
|
from ..util import registry
|
||||||
from .spancat import DEFAULT_SPAN_KEY, Suggester
|
from .spancat import DEFAULT_SPANS_KEY, Suggester
|
||||||
|
|
||||||
span_finder_default_config = """
|
span_finder_default_config = """
|
||||||
[model]
|
[model]
|
||||||
|
@ -50,14 +50,14 @@ DEFAULT_PREDICTED_KEY = "span_candidates"
|
||||||
"threshold": 0.5,
|
"threshold": 0.5,
|
||||||
"model": DEFAULT_SPAN_FINDER_MODEL,
|
"model": DEFAULT_SPAN_FINDER_MODEL,
|
||||||
"predicted_key": DEFAULT_PREDICTED_KEY,
|
"predicted_key": DEFAULT_PREDICTED_KEY,
|
||||||
"training_key": DEFAULT_SPAN_KEY,
|
"training_key": DEFAULT_SPANS_KEY,
|
||||||
# XXX Doesn't 0 seem bad compared to None instead?
|
# XXX Doesn't 0 seem bad compared to None instead?
|
||||||
"max_length": 0,
|
"max_length": 0,
|
||||||
"min_length": 0,
|
"min_length": 0,
|
||||||
"scorer": {
|
"scorer": {
|
||||||
"@scorers": "spacy.span_finder_scorer.v1",
|
"@scorers": "spacy.span_finder_scorer.v1",
|
||||||
"predicted_key": DEFAULT_PREDICTED_KEY,
|
"predicted_key": DEFAULT_PREDICTED_KEY,
|
||||||
"training_key": DEFAULT_SPAN_KEY,
|
"training_key": DEFAULT_SPANS_KEY,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
default_score_weights={
|
default_score_weights={
|
||||||
|
@ -75,7 +75,7 @@ def make_span_finder(
|
||||||
max_length: int,
|
max_length: int,
|
||||||
min_length: int,
|
min_length: int,
|
||||||
predicted_key: str = DEFAULT_PREDICTED_KEY,
|
predicted_key: str = DEFAULT_PREDICTED_KEY,
|
||||||
training_key: str = DEFAULT_SPAN_KEY,
|
training_key: str = DEFAULT_SPANS_KEY,
|
||||||
) -> "SpanFinder":
|
) -> "SpanFinder":
|
||||||
"""Create a SpanFinder component. The component predicts whether a token is
|
"""Create a SpanFinder component. The component predicts whether a token is
|
||||||
the start or the end of a potential span.
|
the start or the end of a potential span.
|
||||||
|
@ -108,7 +108,7 @@ def make_span_finder(
|
||||||
@registry.scorers("spacy.span_finder_scorer.v1")
|
@registry.scorers("spacy.span_finder_scorer.v1")
|
||||||
def make_span_finder_scorer(
|
def make_span_finder_scorer(
|
||||||
predicted_key: str = DEFAULT_PREDICTED_KEY,
|
predicted_key: str = DEFAULT_PREDICTED_KEY,
|
||||||
training_key: str = DEFAULT_SPAN_KEY,
|
training_key: str = DEFAULT_SPANS_KEY,
|
||||||
):
|
):
|
||||||
return partial(
|
return partial(
|
||||||
span_finder_score, predicted_key=predicted_key, training_key=training_key
|
span_finder_score, predicted_key=predicted_key, training_key=training_key
|
||||||
|
@ -119,7 +119,7 @@ def span_finder_score(
|
||||||
examples: Iterable[Example],
|
examples: Iterable[Example],
|
||||||
*,
|
*,
|
||||||
predicted_key: str = DEFAULT_PREDICTED_KEY,
|
predicted_key: str = DEFAULT_PREDICTED_KEY,
|
||||||
training_key: str = DEFAULT_SPAN_KEY,
|
training_key: str = DEFAULT_SPANS_KEY,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
kwargs = dict(kwargs)
|
kwargs = dict(kwargs)
|
||||||
|
@ -163,10 +163,10 @@ class SpanFinder(TrainablePipe):
|
||||||
scorer: Optional[Callable] = partial(
|
scorer: Optional[Callable] = partial(
|
||||||
span_finder_score,
|
span_finder_score,
|
||||||
predicted_key=DEFAULT_PREDICTED_KEY,
|
predicted_key=DEFAULT_PREDICTED_KEY,
|
||||||
training_key=DEFAULT_SPAN_KEY,
|
training_key=DEFAULT_SPANS_KEY,
|
||||||
),
|
),
|
||||||
predicted_key: str = DEFAULT_PREDICTED_KEY,
|
predicted_key: str = DEFAULT_PREDICTED_KEY,
|
||||||
training_key: str = DEFAULT_SPAN_KEY,
|
training_key: str = DEFAULT_SPANS_KEY,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the span boundary detector.
|
"""Initialize the span boundary detector.
|
||||||
model (thinc.api.Model): The Thinc Model powering the pipeline component.
|
model (thinc.api.Model): The Thinc Model powering the pipeline component.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user