Skip to content

Commit

Permalink
Merge pull request #191 from inspirehep/bump-deps
Browse files Browse the repository at this point in the history
Bump deps
  • Loading branch information
jstypka authored Aug 27, 2019
2 parents 579d6c4 + 406a0dc commit 7bd54f8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
language: python
sudo: false
python:
- 2.7
- 3.6
- 3.7

notifications:
email:
Expand Down
8 changes: 4 additions & 4 deletions magpie/base/word2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def compute_word2vec_for_phrase(phrase, model):
"""
result = np.zeros(model.vector_size, dtype='float32')
for word in phrase.split():
if word in model:
result += model[word]
if word in model.wv:
result += model.wv[word]

return result

Expand All @@ -78,8 +78,8 @@ def fit_scaler(data_dir, word2vec_model, batch_size=1024, persist_to_path=None):
vectors = []
for doc in batch:
for word in doc.get_all_words():
if word in word2vec_model:
vectors.append(word2vec_model[word])
if word in word2vec_model.wv:
vectors.append(word2vec_model.wv[word])

matrix = np.array(vectors)
print("Fitted to {} vectors".format(matrix.shape[0]))
Expand Down
4 changes: 2 additions & 2 deletions magpie/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ def _predict(self, doc):
x_matrix = np.zeros((1, sample_length, embedding_size))

for i, w in enumerate(words):
if w in self.word2vec_model:
word_vector = self.word2vec_model[w].reshape(1, -1)
if w in self.word2vec_model.wv:
word_vector = self.word2vec_model.wv[w].reshape(1, -1)
scaled_vector = self.scaler.transform(word_vector, copy=True)[0]
x_matrix[doc.doc_id][i] = scaled_vector

Expand Down
4 changes: 2 additions & 2 deletions magpie/nn/input_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def build_x_and_y(filenames, file_directory, **kwargs):
words = doc.get_all_words()[:SAMPLE_LENGTH]

for i, w in enumerate(words):
if w in word2vec_model:
word_vector = word2vec_model[w].reshape(1, -1)
if w in word2vec_model.wv:
word_vector = word2vec_model.wv[w].reshape(1, -1)
x_matrix[doc_id][i] = scaler.transform(word_vector, copy=True)[0]

labels = get_answers_for_doc(
Expand Down
17 changes: 8 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@

# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
],

Expand All @@ -68,14 +67,14 @@
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=[
'nltk~=3.2',
'numpy~=1.12',
'scipy~=0.18',
'gensim~=0.13',
'scikit-learn~=0.18',
'keras~=2.1.6',
'h5py~=2.6',
'tensorflow~=1.11.0'
'nltk~=3.4',
'numpy~=1.17',
'scipy~=1.3.1',
'gensim~=3.8.0',
'scikit-learn~=0.21.3',
'keras~=2.2.5',
'h5py~=2.9',
'tensorflow~=1.14.0'
],

# List additional groups of dependencies here (e.g. development
Expand Down

0 comments on commit 7bd54f8

Please sign in to comment.