You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_embed_loader.py 450 B

123456789101112
  1. import unittest
  2. from fastNLP.core.vocabulary import Vocabulary
  3. from fastNLP.io.embed_loader import EmbedLoader
  4. class TestEmbedLoader(unittest.TestCase):
  5. def test_case(self):
  6. vocab = Vocabulary()
  7. vocab.update(["the", "in", "I", "to", "of", "hahaha"])
  8. embedding = EmbedLoader().fast_load_embedding(50, "test/data_for_tests/glove.6B.50d_test.txt", vocab)
  9. self.assertEqual(tuple(embedding.shape), (len(vocab), 50))