From e6d8bcdf9b67db1a711d0d73ecced83d47d10e28 Mon Sep 17 00:00:00 2001 From: tstadel <60758086+tstadel@users.noreply.github.com> Date: Thu, 14 Jul 2022 17:59:20 +0200 Subject: [PATCH] Fix gold_contexts_similarity for table retrieval evaluation (#2815) * fix gold_contexts_similarity for table documents * check for type of gold_context --- haystack/pipelines/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/haystack/pipelines/base.py b/haystack/pipelines/base.py index e471a9cdb8..eee12578d9 100644 --- a/haystack/pipelines/base.py +++ b/haystack/pipelines/base.py @@ -1453,8 +1453,8 @@ def _build_eval_dataframe( df_docs["gold_contexts_similarity"] = df_docs.map_rows( lambda row: [ calculate_context_similarity( - gold_context, - row["context"] or "", + str(gold_context) if isinstance(gold_context, pd.DataFrame) else gold_context, + str(row["context"]) if isinstance(row["context"], pd.DataFrame) else row["context"] or "", min_length=context_matching_min_length, boost_split_overlaps=context_matching_boost_split_overlaps, )