From 5654ad1243c2057086c9490179c44c9f7a244311 Mon Sep 17 00:00:00 2001 From: bogdankostic Date: Mon, 8 Nov 2021 15:31:57 +0100 Subject: [PATCH] Fix error when model does not select any cells (#1703) --- haystack/nodes/reader/table.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/haystack/nodes/reader/table.py b/haystack/nodes/reader/table.py index 08d49de3f..b6a6bf2e3 100644 --- a/haystack/nodes/reader/table.py +++ b/haystack/nodes/reader/table.py @@ -195,6 +195,9 @@ class TableReader(BaseReader): # No aggregation needed as only one cell selected as answer_cells if len(answer_cells) == 1: return answer_cells[0] + # Return empty string if model did not select any cell as answer + if len(answer_cells) == 0: + return "" # Parse answer cells in order to aggregate numerical values parsed_answer_cells = [parser.parse(cell) for cell in answer_cells]