From 0e547f4bf1850fd0f028ca14e97eb1d7e6c2be33 Mon Sep 17 00:00:00 2001 From: Malte Pietsch Date: Tue, 14 Jan 2020 17:25:01 +0100 Subject: [PATCH] fix offsets --- haystack/reader/farm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/haystack/reader/farm.py b/haystack/reader/farm.py index 5c7995ba74..448fed517c 100644 --- a/haystack/reader/farm.py +++ b/haystack/reader/farm.py @@ -85,10 +85,10 @@ def predict(self, question, paragrahps, meta_data_paragraphs=None, top_k=None, m if a["answer"]: #skip "no answer" cur = {"answer": a["answer"], "score": a["score"], - "probability": expit(np.asarray([a["score"]]) / 8), #just a pseudo prob for now + "probability": float(expit(np.asarray([a["score"]]) / 8)), #just a pseudo prob for now "context": a["context"], "offset_start": a["offset_answer_start"] - a["offset_context_start"], - "offset_end": a["offset_answer_start"] - a["offset_context_start"], + "offset_end": a["offset_answer_end"] - a["offset_context_start"], "document_id": a["document_id"]} answers.append(cur)