mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-21 17:41:59 +03:00
Apply suggestions from code review
This commit is contained in:
parent
a33c7e0144
commit
3abdca27e4
|
@ -107,7 +107,9 @@ def span_finder_score(examples: Iterable[Example], **kwargs) -> Dict[str, Any]:
|
|||
"getter", lambda doc, key: doc.spans.get(key[len(attr_prefix) :], [])
|
||||
)
|
||||
kwargs.setdefault("has_annotation", lambda doc: key in doc.spans)
|
||||
return Scorer.score_spans(examples, **kwargs)
|
||||
scores = Scorer.score_spans(examples, **kwargs)
|
||||
scores.pop(f"{kwargs['attr']}_per_type", None)
|
||||
return scores
|
||||
|
||||
|
||||
class _MaxInt(int):
|
||||
|
|
|
@ -135,7 +135,6 @@ def test_span_finder_component():
|
|||
nlp.initialize()
|
||||
docs = list(span_finder.pipe(docs))
|
||||
|
||||
# TODO: update hard-coded name
|
||||
assert SPANS_KEY in docs[0].spans
|
||||
|
||||
|
||||
|
@ -252,7 +251,7 @@ def test_overfitting_IO():
|
|||
# Test scoring
|
||||
scores = nlp.evaluate(train_examples)
|
||||
assert f"span_finder_{span_finder.spans_key}_f" in scores
|
||||
# XXX Its not perfect 1.0 F1 because we want it to overgenerate for now.
|
||||
# It's not perfect 1.0 F1 because it's designed to overgenerate for now.
|
||||
assert scores[f"span_finder_{span_finder.spans_key}_f"] == 0.4
|
||||
assert scores[f"span_finder_{span_finder.spans_key}_r"] == 1.0
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user