File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 22import tempfile
33import zipfile
44import numpy as np
5- from gensim .models .keyedvectors import KeyedVectors
65from onir import util
76from onir .interfaces import plaintext
87
@@ -110,6 +109,11 @@ def wrapped(logger):
110109 with logger .duration (f'downloading { url } ' ):
111110 util .download (url , vocab_path )
112111 with logger .duration (f'loading binary { vocab_path } ' ):
112+ try :
113+ from gensim .models .keyedvectors import KeyedVectors
114+ except ModuleNotFoundError as mnfe :
115+ print ("gensim needs to be installed for gensim_w2v_handler to work" )
116+ raise mnfe
113117 vectors = KeyedVectors .load_word2vec_format (vocab_path , binary = True )
114118 vocab_path += '.txt'
115119 with logger .duration (f'saving text { vocab_path } ' ):
Original file line number Diff line number Diff line change @@ -522,6 +522,8 @@ def __str__(self):
522522
523523
524524def _inject (cls , context = {}):
525+ if not hasattr (inspect , 'getargspec' ):
526+ inspect .getargspec = inspect .getfullargspec
525527 spec = inspect .getargspec (cls .__init__ )
526528 args = []
527529 for arg in spec .args :
Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ nltk>=3.4.5
2525git+https://github.com/TREMA-UNH/trec-car-tools.git#subdirectory=python3
2626sqlitedict >= 1.6.0
2727pytrec-eval-terrier >= 0.5.1
28- gensim >= 3.7.3
2928Cython >= 0.29.2
3029pyjnius >= 1.2.1
3130ir_datasets >= 0.2.0
@@ -34,3 +33,6 @@ ir_measures>=0.2.1
3433# misc
3534pytools >= 2018.5.2
3635cached-property >= 1.5.1
36+
37+ # optional:
38+ # gensim>=3.7.3
You can’t perform that action at this time.
0 commit comments