forked from iamalbert/pytorch-wordemb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
36 lines (23 loc) · 911 Bytes
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import unittest
import torch
import torchwordemb
class TestGlove(unittest.TestCase):
def test_glove_text(self):
word, vec = torchwordemb.load_glove_text("resource/glove.test.txt")
self.assertEqual(len(word), 10)
self.assertEqual(vec.size(0), 10)
self.assertEqual(vec.size(1), 300)
def test_word2vec_text(self):
word, vec = torchwordemb.load_word2vec_text("resource/word2vec.test.txt")
self.assertEqual(len(word), 10)
self.assertEqual(vec.size(0), 10)
self.assertEqual(vec.size(1), 300)
def test_word2vec_bin(self):
word, vec = torchwordemb.load_word2vec_bin("resource/word2vec.test.bin")
self.assertEqual(len(word), 113)
self.assertEqual(vec.size(0), 113)
self.assertEqual(vec.size(1), 100)
if __name__ == '__main__':
print(dir(torchwordemb)) #.__path__)
unittest.main()
#