82bf45a64f0a431fa2ab1611abdbe9a135bcabd7,opennmt/tests/inputter_test.py,InputterTest,testPretrainedEmbeddingsLoading,#InputterTest#,93

Before Change


        [4, 1, 2])

  def testPretrainedEmbeddingsLoading(self):
    embedding_file = os.path.join(self.get_temp_dir(), "embedding.txt")
    vocab_file = os.path.join(self.get_temp_dir(), "vocab.txt")

    with io.open(embedding_file, encoding="utf-8", mode="w") as embedding:
      embedding.write(u"toto 1 1\n"
                      u"titi 2 2\n"
                      u"tata 3 3\n")
    with io.open(vocab_file, encoding="utf-8", mode="w") as vocab:
      vocab.write(u"Toto\n"
                  u"tOTO\n"
                  u"tata\n"
                  u"tete\n")

    embeddings = text_inputter.load_pretrained_embeddings(
        embedding_file,
        vocab_file,
        num_oov_buckets=1,

After Change


    return path

  def testPretrainedEmbeddingsLoading(self):
    vocab_file = self._makeTextFile("vocab.txt", ["Toto", "tOTO", "tata", "tete"])
    embedding_file = self._makeEmbeddingsFile(
        [("toto", [1, 1]), ("titi", [2, 2]), ("tata", [3, 3])])

    embeddings = text_inputter.load_pretrained_embeddings(
        embedding_file,
        vocab_file,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 30

Instances


Project Name: OpenNMT/OpenNMT-tf
Commit Name: 82bf45a64f0a431fa2ab1611abdbe9a135bcabd7
Time: 2019-01-12
Author: guillaume.klein@systrangroup.com
File Name: opennmt/tests/inputter_test.py
Class Name: InputterTest
Method Name: testPretrainedEmbeddingsLoading


Project Name: OpenNMT/OpenNMT-tf
Commit Name: 82bf45a64f0a431fa2ab1611abdbe9a135bcabd7
Time: 2019-01-12
Author: guillaume.klein@systrangroup.com
File Name: opennmt/tests/inputter_test.py
Class Name: InputterTest
Method Name: testPretrainedEmbeddingsLoading


Project Name: OpenNMT/OpenNMT-tf
Commit Name: 82bf45a64f0a431fa2ab1611abdbe9a135bcabd7
Time: 2019-01-12
Author: guillaume.klein@systrangroup.com
File Name: opennmt/tests/inputter_test.py
Class Name: InputterTest
Method Name: testWordEmbedderWithPretrainedEmbeddings


Project Name: OpenNMT/OpenNMT-tf
Commit Name: 82bf45a64f0a431fa2ab1611abdbe9a135bcabd7
Time: 2019-01-12
Author: guillaume.klein@systrangroup.com
File Name: opennmt/tests/inputter_test.py
Class Name: InputterTest
Method Name: testPretrainedEmbeddingsWithHeaderLoading