Fix gold_contexts_similarity for table retrieval evaluation (#2815)

* fix gold_contexts_similarity for table documents

* check for type of gold_context
This commit is contained in:
tstadel 2022-07-14 17:59:20 +02:00 committed by GitHub
parent 82df677ebf
commit e6d8bcdf9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1453,8 +1453,8 @@ class Pipeline:
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,
)