File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 4
4
5
5
import numpy as np
6
6
import json
7
+ import os
7
8
import argparse
8
9
import cPickle as pickle
9
10
@@ -40,7 +41,8 @@ def word2vec(word2vec_path):
40
41
if not path .exists (word2vec_path ):
41
42
glove_file_path = get_glove_file_path ()
42
43
print ('Converting Glove to word2vec...' , end = '' )
43
- glove2word2vec (glove_file_path , word2vec_path )
44
+ glove2word2vec (glove_file_path , word2vec_path ) # Convert glove to word2vec
45
+ os .remove (glove_file_path ) # Remove glove file and keep only word2vec
44
46
print ('Done' )
45
47
46
48
print ('Reading word2vec data... ' , end = '' )
Original file line number Diff line number Diff line change 2
2
from __future__ import print_function
3
3
from __future__ import division
4
4
5
+ import os
5
6
from os import path
6
7
from keras .utils .data_utils import get_file
7
8
@@ -33,10 +34,13 @@ def get_glove_file_path():
33
34
origin = '{server}{version}.zip' .format (server = SERVER , version = VERSION )
34
35
cache_dir = path .join (path .abspath (path .dirname (__file__ )), 'data' )
35
36
36
- get_file ('/tmp/glove.zip' ,
37
+ fname = '/tmp/glove.zip'
38
+ get_file (fname ,
37
39
origin = origin ,
38
40
cache_dir = cache_dir ,
39
41
cache_subdir = '' ,
40
42
extract = True )
41
43
44
+ # Remove unnecessary .zip file and keep only extracted .txt version
45
+ os .remove (fname )
42
46
return path .join (cache_dir , VERSION ) + '.txt'
You can’t perform that action at this time.
0 commit comments