def test_fv_and_centroid_creation(self): 
     cs = CentroidSummarizer(doc_dict)
     sorted_docs = cs.summarize()
     expected = [[ 0.0866434, 0., 0., 0., 0.0866434, 0., 0., 0.0866434, 0., 0., 0., 0., 0.0866434, 0., 0., 0., 0., 0., 0.13732654, 0.0866434, 0., 0.0866434, 0., 0., 0., 0., 0., 0., 0., 0.22396993, 0., 0., 0.],
                 [ 0.0866434, 0., 0., 0., 0.0866434, 0., 0., 0.0866434, 0., 0., 0., 0., 0.0866434, 0., 0., 0., 0., 0.13732654, 0., 0.0866434, 0., 0.0866434, 0., 0., 0., 0., 0., 0., 0., 0., 0.22396993, 0., 0.],
                 [ 0.06931472, 0.17917595, 0., 0.35835189, 0.06931472, 0., 0., 0.06931472, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.06931472, 0., 0.06931472, 0.17917595, 0., 0.17917595, 0., 0., 0., 0., 0., 0., 0., 0.],
                 [ 0., 0., 0., 0., 0., 0.19908439, 0., 0., 0., 0.12206803, 0.12206803, 0., 0.07701635, 0., 0., 0., 0.07701635, 0., 0.12206803, 0., 0., 0., 0., 0.19908439, 0., 0.19908439, 0., 0., 0., 0., 0., 0.12206803, 0.],
                 [ 0., 0., 0.13782765, 0., 0., 0., 0., 0., 0.13782765, 0., 0., 0.13782765, 0., 0.13782765, 0.13782765, 0.13782765, 0.05331901, 0., 0., 0., 0.13782765, 0., 0., 0., 0., 0., 0.13782765, 0.13782765, 0.13782765, 0., 0., 0.08450864, 0.13782765],
                 [ 0., 0., 0., 0., 0., 0., 0.35835189, 0., 0., 0.21972246, 0.21972246, 0., 0., 0., 0., 0., 0.13862944, 0.21972246, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]
                 ]
     for i, doc in enumerate(cs.documents.values()):
         diff = numpy.sum(doc.fv - expected[i])
         self.assertAlmostEqual(diff, 0)
         
     expected = [0.04043359, 0.02986266, 0.02297128, 0.05972532, 0.04043359, 0.03318073, 0.05972532, 0.04043359, 0.02297128, 0.05696508, 0.05696508, 0.02297128, 0.04171719, 0.02297128, 0.02297128, 0.02297128, 0.04482747, 0.05950817, 0.04323243, 0.04043359, 0.02297128, 0.04043359, 0.02986266, 0.03318073, 0.02986266, 0.03318073, 0.02297128, 0.02297128, 0.02297128, 0.03732832, 0.03732832, 0.03442944, 0.02297128]
     diff = numpy.sum(cs.centroid - expected)
     self.assertAlmostEqual(diff, 0, places=5)
 def test_ranking(self):
     cs = CentroidSummarizer(doc_dict)
     sorted_docs = cs.summarize()
     expected = [0.21884737839044804, 0.2355835430632936, 0.24201437073508825, 0.25732418417205782, 0.26127247926054975, 0.30161343021498299]
     self.assertEquals(expected, [doc.dist for doc in sorted_docs])