Esempio n. 1
0
def non_scenario_ami(n_words):
    file = open(path + 'result_ami/result_non_scen.txt', 'w')

    meet_list = tools.non_scenario_based

    file.write('************************' + str(meet_list) + '*************************************' + '\n')
    all_documents = tools.all_nonscenario_based_documents
    example = tf_idf_class(all_documents)
    tfidf_representation = example.tfidf()

    for meet in meet_list:
        file.write(meet + '\n')
        file.write('*****************' + '\n')

        c = compare_with_AMI_results(meet)
        c.get_resumes()

        candidate = c.get_best_k_tfidf(n_words, tfidf_representation[tools.non_scenario_based.index(meet)])
        file.write('candidate = ' + str(candidate) + '\n')

        bleu_measure = c.bleu_evaluation(candidate)

        file.write('score_abstractive = ' + str(bleu_measure[0]) + '\n')
        file.write('score_extractive = ' + str(bleu_measure[1]) + '\n')
        file.flush()

        file.write('\n')

        file.flush()

    file.close()
example = tf_idf_class(all_documents)
tfidf_representation = example.tfidf()

counter = 0

for meet in meet_list:

    print '***********'
    print 'meet', meet

    meet_block = classification_scenario_based[counter]

    file.write(str(meet_block) + '\n')
    file.write('*****************' + '\n')

    c = compare_with_AMI_results(meet_block)
    c.get_resumes()

    candidate = c.get_best_k_tfidf(20, tfidf_representation[counter])
    file.write('candidate = ' + str(candidate) + '\n')

    bleu_measure = c.bleu_evaluation(candidate)

    file.write('score_abstractive = ' + str(bleu_measure[0]) + '\n')
    file.write('score_extractive = ' + str(bleu_measure[1]) + '\n')

    file.write('\n')

    file.flush()

    counter += 1
Esempio n. 3
0
# #
# #

meet_list = tools.scenario_based

file.write('************************' + str(meet_list) + '*************************************\n')
all_documents = tools.all_scenario_based_documents
example = tf_idf_class(all_documents)
tfidf_representation = example.tfidf()

for meet in meet_list:
        file.write(meet+ '\n')
        file.write('*****************'+ '\n')

        c = compare_with_AMI_results(meet)
        c.get_resumes()

        candidate = c.get_best_k_tfidf(20, tfidf_representation[tools.scenario_based.index(meet)])
        file.write('candidate = ' + str(candidate)+ '\n')

        bleu_measure = c.bleu_evaluation(candidate)

        file.write('score_abstractive = ' + str(bleu_measure[0]) + '\n')
        file.write(' score_extractive = ' + str(bleu_measure[1])+ '\n')

        file.write('\n')

        file.flush()

file.close()
Esempio n. 4
0
def blocks_4_4_ami(n_words, length= None):
        """
        this function extracts the first
        :return:
        """
        file = open(path + 'result_ami/result_4_4.txt', 'w')
        adress = path + '/manual_corpus/'

        if length is None:
            for meet_list in classification_scenario_based:
                file.write('************************' + str(meet_list) + '*************************************\n')
                all_documents = [tools.text_to_string(adress + i + '.txt') for i in meet_list]
                example = tf_idf_class(all_documents)  # , document_0)
                tfidf_representation = example.tfidf()

                for meet in meet_list:
                    file.write(meet+ '\n')
                    file.write('*****************\n')

                    c = compare_with_AMI_results(meet)
                    c.get_resumes()

                    candidate = c.get_best_k_tfidf(n_words, tfidf_representation[meet_list.index(meet)])
                    file.write('candidate = ' + str(candidate)+ '\n')
                    file.flush()

                    bleu_measure = c.bleu_evaluation(candidate)

                    file.write('score_abstractive = ' + str(bleu_measure[0])+ '\n')
                    file.write('score_extractive = ' + str(bleu_measure[1])+ '\n')
                    file.flush()

                file.write('\n')
                file.flush()
        else:
            for meet_list in classification_scenario_based[0:length]:
                file.write('************************' + str(meet_list) + '*************************************\n')
                all_documents = [tools.text_to_string(adress + i + '.txt') for i in meet_list]
                example = tf_idf_class(all_documents)  # , document_0)
                tfidf_representation = example.tfidf(length)

                for meet in meet_list:
                    file.write(meet+ '\n')
                    file.write('*****************\n')

                    c = compare_with_AMI_results(meet)
                    c.get_resumes()

                    candidate = c.get_best_k_tfidf(n_words, tfidf_representation[meet_list.index(meet)])
                    file.write('candidate = ' + str(candidate)+ '\n')
                    file.flush()

                    bleu_measure = c.bleu_evaluation(candidate)

                    file.write('score_abstractive = ' + str(bleu_measure[0])+ '\n')
                    file.write('score_extractive = ' + str(bleu_measure[1])+ '\n')
                    file.flush()

                file.write('\n')
                file.flush()

        file.close()

        return
Esempio n. 5
0
def blocks_ami(n_words, length = None):

    #print('we are inside')

    file = open(path + 'result_ami/result_4_block_scen.txt', 'w')
    adress_ = path + "manual_blocks/"
    meet_list = ["block_" + str(i + 1) for i in xrange(34)]

    all_documents = [tools.text_to_string(adress_ + i + '.txt') for i in meet_list]

    example = tf_idf_class(all_documents)

    counter = 0

    if length is None:
        tfidf_representation = example.tfidf()
        for meet in meet_list:

            #print '***********'
            #print 'meet', meet

            meet_block = classification_scenario_based[counter]

            file.write(str(meet_block) + '\n')
            file.write('*****************' + '\n')
            file.flush()

            c = compare_with_AMI_results(meet_block)
            c.get_resumes()

            candidate = c.get_best_k_tfidf(n_words, tfidf_representation[counter])
            file.write('candidate = ' + str(candidate) + '\n')
            file.flush()

            bleu_measure = c.bleu_evaluation(candidate)

            file.write('score_abstractive = ' + str(bleu_measure[0]) + '\n')
            file.write('score_extractive = ' + str(bleu_measure[1]) + '\n')
            file.write('\n')

            file.flush()

            counter += 1
    else:
        #print('length is not none')
        tfidf_representation = example.tfidf(length)
        for meet in meet_list[0:length]:
            #print '***********'
            #print 'meet', meet

            meet_block = classification_scenario_based[counter]

            file.write(str(meet_block) + '\n')
            file.write('*****************' + '\n')
            file.flush()

            c = compare_with_AMI_results(meet_block)
            c.get_resumes()

            candidate = c.get_best_k_tfidf(n_words, tfidf_representation[counter])
            file.write('candidate = ' + str(candidate) + '\n')
            file.flush()

            bleu_measure = c.bleu_evaluation(candidate)

            file.write('score_abstractive = ' + str(bleu_measure[0]) + '\n')
            file.write('score_extractive = ' + str(bleu_measure[1]) + '\n')
            file.write('\n')

            file.flush()

            counter += 1

    file.close()