mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 09:26:27 +03:00
merge dicts instead of overwrite
This commit is contained in:
parent
8344143012
commit
89bee0ed77
|
@ -134,7 +134,11 @@ class Scorer:
|
|||
scores.update(self.nlp.tokenizer.score(examples, **self.cfg)) # type: ignore
|
||||
for name, component in self.nlp.pipeline:
|
||||
if hasattr(component, "score"):
|
||||
scores.update(component.score(examples, **self.cfg))
|
||||
comp_sc = component.score(examples, **self.cfg)
|
||||
for k, v in comp_sc.items():
|
||||
if isinstance(v, dict):
|
||||
scores[k] = {**scores.get(k, {}), **v}
|
||||
scores.update({k: v for k, v in comp_sc.items() if not isinstance(v, dict)})
|
||||
return scores
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue
Block a user