mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-06 05:10:21 +03:00
Rename keys instead of using a custom getter in test
This commit is contained in:
parent
27a784de8a
commit
f95237012f
|
@ -186,16 +186,13 @@ def test_evaluate_multiple_textcat_separate(en_vocab):
|
||||||
with custom scorers."""
|
with custom scorers."""
|
||||||
|
|
||||||
def custom_textcat_score(examples, **kwargs):
|
def custom_textcat_score(examples, **kwargs):
|
||||||
def custom_getter(doc, _):
|
scores = Scorer.score_cats(
|
||||||
return doc.cats
|
|
||||||
|
|
||||||
return Scorer.score_cats(
|
|
||||||
examples,
|
examples,
|
||||||
"custom_cats",
|
"cats",
|
||||||
multi_label=False,
|
multi_label=False,
|
||||||
getter=custom_getter,
|
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
return {f"custom_{k}": v for k, v in scores.items()}
|
||||||
|
|
||||||
@spacy.registry.scorers("test_custom_textcat_scorer")
|
@spacy.registry.scorers("test_custom_textcat_scorer")
|
||||||
def make_custom_textcat_scorer():
|
def make_custom_textcat_scorer():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user