def test_text_rank_summarization_ds3_days(self, sampsize, days):
     """Generate something for N day interval"""
     channel, ssamp = random.choice(test_json_msgs_c3)
     samp = ssamp[random.randint(1,len(ssamp)-2):]
     logger.info("Input is segment is %s", samp)
     asd = {'days': days, 'size' : 3, 'txt' : u'Summary for first {} days:\n'.format(days)}
     summ = TextRankTsSummarizer()
     summ.set_channel(channel)
     sumry = summ.summarize(samp, range_spec=asd)
     logger.debug("Summary is %s", sumry)
     # Length of summary is at least 1 and no greater than 3
     self.assertTrue(len(sumry) >= 1)
     self.assertTrue(len(sumry) <= 3)
 def test_text_rank_summarization_ds2_days(self, smp_msgs, days):
     """Generate something for N day interval"""
     logger.info("Input is %s", smp_msgs)
     asd = {'days': days, 'size' : 3, 'txt' : u'Summary for first {} days:\n'.format(days)}
     summ = TextRankTsSummarizer()
     summ.set_channel('elasticsearch')
     sumry = summ.summarize(smp_msgs, range_spec=asd)
     logger.debug("Summary is %s", sumry)
     # Length of summary is at least 1 and no greater than 3
     self.assertTrue(len(sumry) >= 1)
     self.assertTrue(len(sumry) <= 3)
     # Length of summary is less than or equal to the original length
     self.assertTrue(len(sumry) <= len(smp_msgs))
Ejemplo n.º 3
0
 def test_gensim_summarization(self):
     """Pass the intervals to summarizer"""
     if "gensim" in SUMMS:
         asd = [
             {"minutes": 60, "size": 2, "txt": u"Summary for first 60 minutes:\n"},
             {"hours": 12, "size": 1, "txt": u"Summary for last 12 hours:\n"},
         ]
         summ = None
         summ = TextRankTsSummarizer()
         summ.set_channel("elasticsearch")
         logger.debug("Testing gensim summarizer")
         sumry = summ.summarize(TestSummarize.test_msgs, range_spec=asd)
         logger.debug("Summary is %s", sumry)
         self.assertTrue(len(sumry) > 1)
     else:
         pass
Ejemplo n.º 4
0
 def test_text_rank_summarization_ds3_days(self, sampsize, days):
     """Generate something for N day interval"""
     channel, ssamp = random.choice(test_json_msgs_c3)
     samp = ssamp[random.randint(1, len(ssamp) - 2):]
     logger.info("Input is segment is %s", samp)
     asd = {
         'days': days,
         'size': 3,
         'txt': u'Summary for first {} days:\n'.format(days)
     }
     summ = TextRankTsSummarizer()
     summ.set_channel(channel)
     sumry = summ.summarize(samp, range_spec=asd)
     logger.debug("Summary is %s", sumry)
     # Length of summary is at least 1 and no greater than 3
     self.assertTrue(len(sumry) >= 1)
     self.assertTrue(len(sumry) <= 3)
Ejemplo n.º 5
0
 def test_text_rank_summarization_ds2_days(self, smp_msgs, days):
     """Generate something for N day interval"""
     logger.info("Input is %s", smp_msgs)
     asd = {
         'days': days,
         'size': 3,
         'txt': u'Summary for first {} days:\n'.format(days)
     }
     summ = TextRankTsSummarizer()
     summ.set_channel('elasticsearch')
     sumry = summ.summarize(smp_msgs, range_spec=asd)
     logger.debug("Summary is %s", sumry)
     # Length of summary is at least 1 and no greater than 3
     self.assertTrue(len(sumry) >= 1)
     self.assertTrue(len(sumry) <= 3)
     # Length of summary is less than or equal to the original length
     self.assertTrue(len(sumry) <= len(smp_msgs))
Ejemplo n.º 6
0
 def test_gensim_summarization(self):
     """Pass the intervals to summarizer"""
     if "gensim" in SUMMS:
         asd = [{
             'minutes': 60,
             'size': 2,
             'txt': u'Summary for first 60 minutes:\n'
         }, {
             'hours': 12,
             'size': 1,
             'txt': u'Summary for last 12 hours:\n'
         }]
         summ = None
         summ = TextRankTsSummarizer()
         summ.set_channel('elasticsearch')
         logger.debug("Testing gensim summarizer")
         sumry = summ.summarize(TestSummarize.test_msgs, range_spec=asd)
         logger.debug("Summary is %s", sumry)
         self.assertTrue(len(sumry) > 1)
     else:
         pass