From cf5026b07f8fe5cbda65eb339e5e37b415fed190 Mon Sep 17 00:00:00 2001 From: Biswarup Saha <56034566+1biswarup2@users.noreply.github.com> Date: Mon, 2 Oct 2023 23:15:59 +0530 Subject: [PATCH] Update tweet_sum_processor.py Removed two errors form pre-existing code --- tweet_sum_processor.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tweet_sum_processor.py b/tweet_sum_processor.py index 8f8a0ea..d865609 100644 --- a/tweet_sum_processor.py +++ b/tweet_sum_processor.py @@ -77,8 +77,9 @@ def get_json(self) -> json: extractive_summaries_to_json.append(summ_json) abstractive_summaries_to_json = list() for summ in self.abstractive_summaries: - abst_json = [txt for txt in summ ] - abstractive_summaries_to_json.append(abst_json) + if summ is not None: + abst_json = [txt for txt in summ ] + abstractive_summaries_to_json.append(abst_json) result = { 'dialog' : dialog, @@ -107,9 +108,12 @@ def __str__(self): result += 'Abstractive summaries:\n' result += '=-=-=-=-=-=-=-=-=-=-=\n' for cnt,abstractive_summary in enumerate(self.abstractive_summaries): - result += ('{0}:\n'.format(cnt)) - result += '\t' + ' '.join(abstractive_summary) +'\n' - result += '\n' + try: + result += ('{0}:\n'.format(cnt)) + result += '\t' + ' '.join(abstractive_summary) +'\n' + result += '\n' + except TypeError: + continue return result