91184b6bdcdbce3a37cc91a54801b98356910849,theanolm/commands/score.py,,_score_text,#Any#Any#Any#Any#Any#Any#,78

Before Change


                continue
            seq_word_ids = word_ids[:, seq_index]
            output_file.write("////// Sentence {0}\n".format(num_sentences))
            seq_details = [str(word_id) + ":" + str(logprob)
                for word_id, logprob in zip(seq_word_ids, seq_logprobs)]
            output_file.write(" ".join(seq_details) + "\n")
            output_file.write("Sentence perplexity: {0}\n\n".format(
                numpy.exp(-seq_logprob / seq_length)))

    output_file.write("Number of words: {0}\n".format(num_words))

After Change


            seq_word_ids = word_ids[:, seq_index]
            seq_class_names = dictionary.ids_to_names(seq_word_ids)
            output_file.write("// Sentence {0}\n".format(num_sentences))
            for word_index, word_logprob in enumerate(seq_logprobs):
                if word_index - 2 > 0:
                    history = seq_class_names[word_index:word_index - 3:-1]
                    history.append("...")
                else:
                    history = seq_class_names[word_index::-1]
                output_file.write("log(p({0} | {1})) = {2}\n".format(
                    seq_class_names[word_index + 1],
                    ", ".join(history),
                    seq_logprobs[word_index]))
            output_file.write("Sentence perplexity: {0}\n\n".format(
                numpy.exp(-seq_logprob / seq_length)))

    output_file.write("Number of words: {0}\n".format(num_words))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: senarvi/theanolm
Commit Name: 91184b6bdcdbce3a37cc91a54801b98356910849
Time: 2015-11-22
Author: seppo.git@marjaniemi.com
File Name: theanolm/commands/score.py
Class Name:
Method Name: _score_text


Project Name: NTMC-Community/MatchZoo
Commit Name: cea292769af4ac688649573a11b20f4d69024e3d
Time: 2019-05-15
Author: 469413628@qq.com
File Name: tests/unit_test/processor_units/test_processor_units.py
Class Name:
Method Name: test_bert_tokenizer_unit


Project Name: RaRe-Technologies/gensim
Commit Name: 1aa7e115fcf87b443373c14b7b2f3dd2e3383584
Time: 2011-02-19
Author: radimrehurek@seznam.cz
File Name: src/gensim/corpora/svmlightcorpus.py
Class Name: SvmLightCorpus
Method Name: saveCorpus