Rename keys instead of using a custom getter in test

This commit is contained in:
Adriane Boyd 2022-12-14 09:28:14 +01:00
parent 27a784de8a
commit f95237012f

View File

@ -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():