Exemple #1
0
    def test_text_summarization_on_short_input_text_is_empty_string(self):
        text = self._get_text_from_test_data("testsummarization_unrelated.txt")

        # Keeps the first 8 sentences to make the text shorter.
        text = "\n".join(text.split('\n')[:8])

        self.assertNotEqual(summarize(text), u"")
Exemple #2
0
    def test_text_summarization(self):
        text = self._get_text_from_test_data("mihalcea_tarau.txt")

        # Makes a summary of the text.
        generated_summary = summarize(text)

        # To be compared to the method reference.
        summary = self._get_text_from_test_data("mihalcea_tarau.summ.txt")

        self.assertEqual(generated_summary, summary)
Exemple #3
0
 def test_summary_from_unrelated_sentences(self):
     # Tests that the summarization of a text with unrelated sentences is not empty string.
     text = self._get_text_from_test_data("testsummarization_unrelated.txt")
     generated_summary = summarize(text)
     self.assertNotEqual(generated_summary, u"")
Exemple #4
0
 def test_low_distinct_words_summarization_with_split_is_empty_list(self):
     text = self._get_text_from_test_data("testlowdistinctwords.txt")
     self.assertEqual(summarize(text, split=True), [])
Exemple #5
0
 def test_low_distinct_words_summarization_is_empty_string(self):
     text = self._get_text_from_test_data("testlowdistinctwords.txt")
     self.assertEqual(summarize(text), u"")
Exemple #6
0
 def test_empty_text_summarization_with_split_is_empty_list(self):
     self.assertEqual(summarize("", split=True), [])
Exemple #7
0
 def test_empty_text_summarization_is_empty_string(self):
     self.assertEqual(summarize(""), u"")