Skip to content

Commit cdc6b75

Browse files
author
Ram Idavalapati
authored
Merge pull request #31 from RamanjaneyuluIdavalapati/master
service import place changed in command
2 parents e4a5e4e + 7cf7bb5 commit cdc6b75

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

wordvecspace/command.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from .convert import GW2VectoWordVecSpaceFile
66
from .mem import WordVecSpaceMem
77
from .annoy import WordVecSpaceAnnoy
8-
from .server import WordVecSpaceServer
98
from .exception import UnknownType
109

1110
class WordVecSpaceCommand(BaseScript):
@@ -60,6 +59,14 @@ def interact(self):
6059
raise UnknownType(self.args.type)
6160

6261
def runserver(self):
62+
# Installing service feature is optional.
63+
# Service feature depends on kwikapi.
64+
65+
# We imported here because it should not distrub
66+
# interact fuctionality even though kwikapi is not installed.
67+
68+
from .server import WordVecSpaceServer
69+
6370
if self.args.type == 'mem':
6471
server = WordVecSpaceServer(self.args.type,
6572
self.args.input_file,

wordvecspace/mem.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,8 @@ def get_distances(self, row_words_or_indices, col_words_or_indices=None, metric=
384384
>>> check_equal(res, np.array([[ 0.381, 0., 0.9561]], dtype=np.float32), decimal=4)
385385
>>> res = wv.get_distances("for", ["to", "for", "inidia"])
386386
>>> check_equal(res, np.array([[ 0.381, 0., 1.]], dtype=np.float32), decimal=4)
387-
>>> print(wv.get_distances(["india", "for"], ["to", "for", "usa"]))
388-
[[ 1.0685 0.9561 0.3251]
389-
[ 0.381 0. 1.4781]]
387+
>>> res = wv.get_distances(["india", "for"], ["to", "for", "usa"])
388+
>>> check_equal(res, np.array([[ 1.0685, 0.9561, 0.3251], [ 0.381, 0., 1.4781]], dtype=np.float32), decimal=1)
390389
>>> print(wv.get_distances(["india", "usa"]))
391390
[[ 1.3853 0.4129 0.3149 ..., 1.1231 1.4595 0.7912]
392391
[ 1.3742 0.9549 1.0354 ..., 0.5556 1.0847 1.0832]]

0 commit comments

Comments
 (0)