# Path: dsenser/word2vec.py
# class Word2Vec(object):
#     """Class for cached retrieval of word embeddings.
# 
#     """
# 
#     def __init__(self, a_w2v=W2V):
#         """Class cosntructor.
# 
#         Args:
#           a_w2v (gensim.Word2Vec):
#             dictionary with original word embeddings
# 
#         """
#         self._w2v = a_w2v
#         self._cache = {}
#         self.ndim = -1
# 
#     def __contains__(self, a_word):
#         """Proxy method for looking up a word in the resource.
# 
#         Args:
#         a_word (str): word to look up in the resource
# 
#         Returns:
#         (bool):
#         true if the word is present in the underlying resource
# 
#         """
#         if a_word in self._cache:
#             return True
#         elif a_word in self._w2v:
#             self._cache[a_word] = self._w2v[a_word]
#             return True
#         return False
# 
#     def __getitem__(self, a_word):
#         """Proxy method for looking up a word in the resource.
# 
#         Args:
#         a_word (str): word to look up in the resource
# 
#         Returns:
#         (bool):
#         true if the word is present in the underlying resource
# 
#         """
#         if a_word in self._cache:
#             return self._cache[a_word]
#         elif a_word in self._w2v:
#             emb = self._cache[a_word] = self._w2v[a_word]
#             return emb
#         raise KeyError
# 
#     def load(self):
#         """Load the word2vec resource.
# 
#         Args:
#         (void):
# 
#         Returns:
#         (void):
#         load the resource in place
# 
#         """
#         self._w2v.load()
#         self.ndim = self._w2v.resource.vector_size
# 
#     def unload(self):
#         """Unload the word2vec resource.
# 
#         Args:
#         (void):
# 
#         Returns:
#         (void):
#         load the resource in place
# 
#         """
#         self._cache.clear()
#         self._w2v.unload()


from dsenser.word2vec import Word2Vec
from mock import patch, MagicMock
from pytest import fixture
from unittest import TestCase
import pytest
#!/usr/bin/env python
# -*- coding: utf-8; mode: python; -*-

##################################################################
# Imports
from __future__ import absolute_import




##################################################################
# Variables and Constants
W2V = MagicMock()
DFLT_VEC_SIZE = 300


##################################################################
# Test Classes
class TestWord2Vec(TestCase):
    @fixture(autouse=True)
    def set_w2v(self):

# Path: dsenser/word2vec.py
# class Word2Vec(object):
#     """Class for cached retrieval of word embeddings.
# 
#     """
# 
#     def __init__(self, a_w2v=W2V):
#         """Class cosntructor.
# 
#         Args:
#           a_w2v (gensim.Word2Vec):
#             dictionary with original word embeddings
# 
#         """
#         self._w2v = a_w2v
#         self._cache = {}
#         self.ndim = -1
# 
#     def __contains__(self, a_word):
#         """Proxy method for looking up a word in the resource.
# 
#         Args:
#         a_word (str): word to look up in the resource
# 
#         Returns:
#         (bool):
#         true if the word is present in the underlying resource
# 
#         """
#         if a_word in self._cache:
#             return True
#         elif a_word in self._w2v:
#             self._cache[a_word] = self._w2v[a_word]
#             return True
#         return False
# 
#     def __getitem__(self, a_word):
#         """Proxy method for looking up a word in the resource.
# 
#         Args:
#         a_word (str): word to look up in the resource
# 
#         Returns:
#         (bool):
#         true if the word is present in the underlying resource
# 
#         """
#         if a_word in self._cache:
#             return self._cache[a_word]
#         elif a_word in self._w2v:
#             emb = self._cache[a_word] = self._w2v[a_word]
#             return emb
#         raise KeyError
# 
#     def load(self):
#         """Load the word2vec resource.
# 
#         Args:
#         (void):
# 
#         Returns:
#         (void):
#         load the resource in place
# 
#         """
#         self._w2v.load()
#         self.ndim = self._w2v.resource.vector_size
# 
#     def unload(self):
#         """Unload the word2vec resource.
# 
#         Args:
#         (void):
# 
#         Returns:
#         (void):
#         load the resource in place
# 
#         """
#         self._cache.clear()
#         self._w2v.unload()


# Path: tests/test_word2vec.py
from dsenser.word2vec import Word2Vec
from mock import patch, MagicMock
from pytest import fixture
from unittest import TestCase
import pytest

#!/usr/bin/env python
# -*- coding: utf-8; mode: python; -*-

##################################################################
# Imports
from __future__ import absolute_import




##################################################################
# Variables and Constants
W2V = MagicMock()
DFLT_VEC_SIZE = 300


##################################################################
# Test Classes
class TestWord2Vec(TestCase):
    @fixture(autouse=True)
    def set_w2v(self):

        self.w2v = Word2Vec