def summarize(self): """ Generate a summary for this cluster. """ if self.members.count() == 1: self.summary = self.members[0].summary else: self.summary = ' '.join(multisummarize([m.summary for m in self.members])) return self.summary
def summarize(self): """ Generate a summary for this cluster. """ if self.members.count() == 1: self.summary = self.members[0].summary else: self.summary = ' '.join( multisummarize([m.summary for m in self.members])) return self.summary
def summarize(self): """ Generate a summary for this cluster. """ if len(self.members) == 1: member = self.members[0] self.summary = ' '.join(summarize(member.title, member.text)) else: self.summary = ' '.join(multisummarize([m.text for m in self.members])) return self.summary
def summarize(self): """ Generate a summary for this cluster. """ if len(self.members) == 1: member = self.members[0] self.summary = ' '.join(summarize(member.title, member.text)) else: self.summary = ' '.join( multisummarize([m.text for m in self.members])) return self.summary
def summarize(self): """ Generate a summary for this cluster. """ if self.members.count() == 1: member = self.members[0] summary_sentences = summarizer.summarize(member.title, member.text) self.summary = ' '.join(summary_sentences) else: summary_sentences = summarizer.multisummarize([m.text for m in self.members]) self.summary = ' '.join(summary_sentences) return self.summary
def summarize(self): """ Generate a summary for this cluster. """ if self.members.count() == 1: member = self.members[0] summary_sentences = summarizer.summarize(member.title, member.text) self.summary = ' '.join(summary_sentences) else: summary_sentences = summarizer.multisummarize( [m.text for m in self.members]) self.summary = ' '.join(summary_sentences) return self.summary
def test_multidoc_summarize(self): docs = [open('tests/data/multidoc/{0}.txt'.format(i+1), 'r').read() for i in range(4)] summary = summarizer.multisummarize(docs, summary_length=5) summary_without_nones = list(filter(None, summary)) self.assertEqual(len(summary_without_nones), 5)