From 53785c27803d39b783f33f6ce097d03b48f7240f Mon Sep 17 00:00:00 2001 From: VISHAL SINGH <56965195+vishalsingha@users.noreply.github.com> Date: Tue, 4 Aug 2020 17:04:07 +0530 Subject: [PATCH] Added few lines to demo_manager.py Added code to remove some printing bug like ( ["do n't", "ca n't" etc.] will now be printed as ["don't", "can't" etc.] ). --- viscap/visdialch/data/demo_manager.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/viscap/visdialch/data/demo_manager.py b/viscap/visdialch/data/demo_manager.py index 81287ca..3809349 100644 --- a/viscap/visdialch/data/demo_manager.py +++ b/viscap/visdialch/data/demo_manager.py @@ -249,6 +249,10 @@ def respond(self, user_question): answer = TreebankWordDetokenizer().detokenize(answer) + if "n't" in answer: + idx_ = answer.find("n't") + answer = ''.join([answer[i] for i in range(len(answer)) if i != idx_-1]) + # Update the dialog history and return answer self._update(user_question, answer) return answer