Exemple #1
0
 def compare_and_print_tfidf(cls, title_a, report_a,
                             title_b, report_b):
     from ir_log import IRLog
     from ir_config import IRConfig
     from ir_tfidf import IRTFIDF
     
     summary_field_name = IRConfig.get_instance().get('bug_summary_name')
     description_field_name = IRConfig.get_instance().get('bug_description_name')
     summary_a, description_a = report_a.get_summary_and_description_tfidf()
     summary_b, description_b = report_b.get_summary_and_description_tfidf()
     IRLog.get_instance().println('[TFIDF][Summary][%s][%s]' \
             % (title_a, title_b))
     IRTFIDF.show_dict_compare(summary_a, summary_b, summary_field_name)
     IRLog.get_instance().println('[TFIDF][Description][%s][%s]' \
             % (title_a, title_b))
     IRTFIDF.show_dict_compare(description_a, description_b, description_field_name)
Exemple #2
0
    def test_calculate_tfidf_for_report_termcount_bidf(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')
        IRConfig.get_instance().set('tfidf_algorithm', 'bidf')
        summary = {'firefox':5, 'chrome':12}
        description = {'max':10, 'min':30, 'fix':10}
        summary_tfidf, description_tfidf = \
            IRTFIDF.calculate_tfidf_for_report_termcount(summary, description)
        IRLog.get_instance().println('Summary')
        IRTFIDF.show_dict_compare(summary_tfidf, summary_tfidf)
        IRLog.get_instance().println('Description')
        IRTFIDF.show_dict_compare(description_tfidf, description_tfidf)
        IRLog.get_instance().stop_log()
Exemple #3
0
    def compare_and_print_tfidf(cls, title_a, report_a, title_b, report_b):
        from ir_log import IRLog
        from ir_config import IRConfig
        from ir_tfidf import IRTFIDF

        summary_field_name = IRConfig.get_instance().get('bug_summary_name')
        description_field_name = IRConfig.get_instance().get(
            'bug_description_name')
        summary_a, description_a = report_a.get_summary_and_description_tfidf()
        summary_b, description_b = report_b.get_summary_and_description_tfidf()
        IRLog.get_instance().println('[TFIDF][Summary][%s][%s]' \
                % (title_a, title_b))
        IRTFIDF.show_dict_compare(summary_a, summary_b, summary_field_name)
        IRLog.get_instance().println('[TFIDF][Description][%s][%s]' \
                % (title_a, title_b))
        IRTFIDF.show_dict_compare(description_a, description_b,
                                  description_field_name)
Exemple #4
0
    def test_show_dict_compare(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_name = IRConfig.get_instance().get('bug_summary_name')
        description_name = IRConfig.get_instance().get('bug_description_name')
        
        summary_a, description_a = IRTFIDF.get_tfidf_of_bug(100000)
        summary_b, description_b = IRTFIDF.get_tfidf_of_bug(100200)
        IRLog.get_instance().println('Summary 100000 vs 100200')
        IRTFIDF.show_dict_compare(summary_a, summary_b, summary_name)
        IRLog.get_instance().println('Description 100000 vs 100200')
        IRTFIDF.show_dict_compare(description_a, description_b)
        IRLog.get_instance().println('Summary 100000 vs 100000')
        IRTFIDF.show_dict_compare(summary_a, summary_a)
        IRLog.get_instance().println('Description 100000 vs 100000')
        IRTFIDF.show_dict_compare(description_a, description_a, description_name)