91184b6bdcdbce3a37cc91a54801b98356910849,theanolm/commands/score.py,,_score_utterances,#Any#Any#Any#Any#Any#,141

Before Change


    num_words = 0
    num_unks = 0
    for line_num, line in enumerate(input_file):
        words = ["<s>"]
        words.extend(line.split())
        words.append("</s>")

        word_ids = dictionary.words_to_ids(words)
        num_words += len(word_ids)
        num_unks += word_ids.count(dictionary.unk_id)
        word_ids = numpy.array([[x] for x in word_ids]).astype("int64")
        
        probs = dictionary.words_to_probs(words)
        probs = numpy.array([[x] for x in probs]).astype(theano.config.floatX)

After Change


    for line_num, line in enumerate(input_file):
        words = line.split()
        if words[0] != "<s>":
            words.insert(0, "<s>")
        if words[-1] != "</s>":
            words.append("</s>")

        word_ids = dictionary.words_to_ids(words)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

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_utterances


Project Name: matplotlib/matplotlib
Commit Name: d9839d4de441381c2908d832ac320c58bf7e3695
Time: 2017-10-13
Author: fuzzy0427@gmail.com
File Name: examples/event_handling/poly_editor.py
Class Name: PolygonInteractor
Method Name: key_press_callback


Project Name: matplotlib/matplotlib
Commit Name: 6a18d6b58ec3ca42de7bc2cf5206f117c59e3318
Time: 2017-10-21
Author: tcaswell@gmail.com
File Name: examples/event_handling/poly_editor.py
Class Name: PolygonInteractor
Method Name: key_press_callback