80e9e26deca028ef6b1b51c307b61bb305dc9b1c,txtgen/data/embedding_test.py,EmbeddingTest,test_load_glove,#EmbeddingTest#,23

Before Change


        word_vecs, vector_size = embedding.load_glove(glove_file.name)

        self.assertEqual(len(word_vecs), 2)
        self.assertEqual(set(word_vecs.keys()),
                         set(["word", "词".encode("utf-8")]))
        self.assertEqual(vector_size, 3)
        np.testing.assert_array_equal(word_vecs["word"], [1.2, 3.4, 5.6])

    def test_load_word2vec(self):

After Change


        glove_file = tempfile.NamedTemporaryFile(mode="w+")
        glove_file.write("\n".join(word_vec_lines).encode("utf-8"))
        glove_file.flush()
        vocab = {"word": 0, "词".encode("utf8"): 1}
        word_vecs = np.zeros([2, 3])

        word_vecs = embedding.load_glove(glove_file.name, vocab, word_vecs)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 2

Instances


Project Name: asyml/texar
Commit Name: 80e9e26deca028ef6b1b51c307b61bb305dc9b1c
Time: 2017-09-04
Author: zhitinghu@gmail.com
File Name: txtgen/data/embedding_test.py
Class Name: EmbeddingTest
Method Name: test_load_glove


Project Name: explosion/thinc
Commit Name: cc1a73270515bcb30c091791db4f40f136c93fe4
Time: 2019-12-25
Author: honnibal+gh@gmail.com
File Name: thinc/tests/test_config.py
Class Name:
Method Name: test_optimizer_config


Project Name: matplotlib/matplotlib
Commit Name: 39fb7b5b96ea46aca94099d166106365eaf0647e
Time: 2018-03-08
Author: anntzer.lee@gmail.com
File Name: lib/matplotlib/tests/test_backend_ps.py
Class Name:
Method Name: test_savefig_to_stringio