From f8cf378be9087864328d9ad5b90bc15e78021cba Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Mon, 27 Jul 2020 10:21:31 +0200 Subject: [PATCH] Combine weights from multiple components Combine weights from multiple components for the same score. --- spacy/util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spacy/util.py b/spacy/util.py index 7eb605cc6..d23874bae 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -1143,7 +1143,8 @@ def combine_score_weights(weights: List[Dict[str, float]]) -> Dict[str, float]: # score weights accordingly, then divide score by the number of components total = sum([w for w in w_dict.values()]) for key, value in w_dict.items(): - result[key] = round(value / total / len(weights), 2) + weight = round(value / total / len(weights), 2) + result[key] = result.get(key, 0.0) + weight return result