dc0a4f77cd11b1e237b4d96186e799f79065fc98,theanolm/commands/score.py,,_score_text,#Any#Any#Any#Any#Any#Any#Any#,124

Before Change


            num_seq_probs = sum(x is not None for x in merged_logprobs)
            num_probs += num_seq_probs
            // number of <unk>"s (just for reporting)
            num_unks += len(merged_logprobs) - num_seq_probs
            // number of sequences
            num_sentences += 1

            if word_level:

After Change


    num_words = 0
    num_probs = 0
    num_unks = 0
    num_zeroprobs = 0
    for word_ids, words, mask in scoring_iter:
        class_ids, membership_probs = vocabulary.get_class_memberships(word_ids)
        logprobs = scorer.score_batch(word_ids, class_ids, membership_probs,
                                      mask)
        for seq_index, seq_logprobs in enumerate(logprobs):
            seq_word_ids = word_ids[:, seq_index]
            seq_mask = mask[:, seq_index]
            seq_word_ids = seq_word_ids[seq_mask == 1]
            seq_words = words[seq_index]
            merged_words, merged_logprobs = _merge_subwords(seq_words,
                                                            seq_logprobs,
                                                            subword_marking)

            // total logprob of this sequence
            seq_logprob = sum(lp for lp in merged_logprobs
                              if (lp is not None) and (not numpy.isneginf(lp)))
            // total logprob of all sequences
            total_logprob += seq_logprob
            // number of tokens, which may be subwords, including <unk>"s
            num_tokens += len(seq_word_ids)
            // number of words, including <s>"s and <unk>"s
            num_words += len(merged_words)
            // number of word probabilities computed (may not include <unk>"s)
            num_seq_probs = sum((lp is not None) and (not numpy.isneginf(lp))
                                for lp in merged_logprobs)
            num_probs += num_seq_probs
            // number of unks and zeroprobs (just for reporting)
            num_unks += sum(lp is None for lp in merged_logprobs)
            num_zeroprobs += sum(numpy.isneginf(lp) for lp in merged_logprobs)
            // number of sequences
            num_sentences += 1

            if word_level:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: senarvi/theanolm
Commit Name: dc0a4f77cd11b1e237b4d96186e799f79065fc98
Time: 2017-07-17
Author: seppo.git@marjaniemi.com
File Name: theanolm/commands/score.py
Class Name:
Method Name: _score_text


Project Name: mozilla/bugbug
Commit Name: f16992b25bb153df3ab87c5111db2a101cf68c73
Time: 2020-04-09
Author: mcastelluccio@mozilla.com
File Name: bugbug/models/testselect.py
Class Name: TestSelectModel
Method Name: train_test_split


Project Name: pymc-devs/pymc3
Commit Name: 0ebd2abe454dbb37a8bec4fd262341f131158818
Time: 2013-05-08
Author: jsalvatier@gmail.com
File Name: pymc/step_methods/metropolis.py
Class Name: Metropolis
Method Name: __init__