Skip to content

Commit

Permalink
test for create vocab from file
Browse files Browse the repository at this point in the history
  • Loading branch information
undertherain committed Apr 23, 2018
1 parent 0d99636 commit 9c2b3cd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/test_vocab.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Tests for vocabulary module."""

import unittest
from vsmlib.vocabulary import create_from_dir, Vocabulary
from vsmlib.vocabulary import create_from_dir, create_from_file, Vocabulary

path_text = "./test/data/corpora/plain"
path_vocab = "./test/data/vocabs/plain"
Expand All @@ -15,6 +15,11 @@ def test_create_from_dir(self):
assert vocab.get_id("the") >= 0
vocab.save_to_dir("/tmp/vsmlib/vocab")

def test_create_from_file(self):
vocab = create_from_file("test/data/corpora/plain/sense_small.txt", min_frequency=10)
print("the:", vocab.get_id("the"))
assert vocab.get_id("the") >= 0

def test_load_from_dir(self):
vocab = Vocabulary()
vocab.load(path_vocab)
Expand Down

0 comments on commit 9c2b3cd

Please sign in to comment.