def test_clustering(self): s = summarizer.Summarizer() testdir = os.path.dirname(os.path.realpath(__file__)) doc = document.Document(os.path.join(testdir, 'testdata/smalldoc.txt')) s.addDocument(doc) s.addDocument(doc) s.clusterSentences() self.assertEqual(len(s.clusters), 2)
def test_selectSentences(self): s = summarizer.Summarizer() testdir = os.path.dirname(os.path.realpath(__file__)) doc1 = document.Document(os.path.join(testdir, 'testdata/smalldoc.txt')) doc2 = document.Document(os.path.join(testdir, 'testdata/smalldocb.txt')) s.addDocument(doc1) s.addDocument(doc2) maxwords = 50 s.summarize(maxwords) print(s.summary)
def test_doclogic(self): s = summarizer.Summarizer() testdir = os.path.dirname(os.path.realpath(__file__)) doc = document.Document(os.path.join(testdir, 'testdata/smalldoc.txt')) s.addDocument(doc) s.addDocument(doc) self.assertEqual(len(s.documents), 2) s.clearDocuments() self.assertEqual(s.documents, None) s.setDocuments([doc]) self.assertEqual(len(s.documents), 1)
def test_init(self): s = summarizer.Summarizer() testdir = os.path.dirname(os.path.realpath(__file__)) doc = document.Document(os.path.join(testdir, 'testdata/smalldoc.txt')) s.addDocument(doc) self.assertEqual(len(s.documents), 1)