Beispiel #1
0
 def get_summary_and_description_tfidf_squared_length(self):
     from ir_tfidf import IRTFIDF
     if self.__summary_squared_length is None or \
                     self.__description_squared_length is None:
         summary, description = self.get_summary_and_description_tfidf()
         self.__summary_squared_length = \
                 IRTFIDF.get_squared_length(summary)
         self.__description_squared_length = \
                 IRTFIDF.get_squared_length(description)
     return self.__summary_squared_length, self.__description_squared_length
Beispiel #2
0
 def get_summary_and_description_tfidf_squared_length(self):
     from ir_tfidf import IRTFIDF
     if self.__summary_squared_length is None or \
                     self.__description_squared_length is None:
         summary, description = self.get_summary_and_description_tfidf()
         self.__summary_squared_length = \
                 IRTFIDF.get_squared_length(summary)
         self.__description_squared_length = \
                 IRTFIDF.get_squared_length(description)
     return self.__summary_squared_length, self.__description_squared_length
Beispiel #3
0
    def test_get_squared_length(self):
        from ir_log import IRLog
        from ir_config import IRConfig
        from ir_tfidf import IRTFIDF

        IRLog.get_instance().start_log()
        IRConfig.get_instance().load('../data/test/bug_test.cfg')
        summary = {'firefox':0.4, 'chrome':0.6}
        assert abs(IRTFIDF.get_squared_length(summary) - 0.52 ) < 0.00001