Skip to content

Commit

Permalink
remove unused dependency, handle ImportError (#3447)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenkov authored Mar 7, 2023
1 parent 7002a60 commit cfb1a62
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
23 changes: 19 additions & 4 deletions gensim/models/flsamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
@author: 20200016
"""

import math
from collections import Counter
import warnings
import pickle
import itertools
import math
import pickle
import sys
import warnings

import numpy as np
from scipy.sparse.linalg import svds
from scipy.sparse import dok_matrix
from pyfume import Clustering

import gensim.corpora as corpora
from gensim.models.coherencemodel import CoherenceModel
from gensim.models import Word2Vec
Expand Down Expand Up @@ -699,6 +701,19 @@ def _create_partition_matrix(
-------
numpy.array : float
"""

try:
from pyfume import Clustering
except ImportError:
msg = (
"FlsaModel requires pyfume; install manually via "
"`pip install pyfume` or otherwise"
)
print('-' * len(msg), file=sys.stderr)
print(msg, file=sys.stderr)
print('-' * len(msg), file=sys.stderr)
raise

clusterer = Clustering.Clusterer(
nr_clus=number_of_clusters,
data=data,
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ def run(self):
NUMPY_STR,
'scipy >= 1.7.0',
'smart_open >= 1.8.1',
'FuzzyTM >= 0.4.0'
]

setup_requires = [NUMPY_STR]
Expand Down

0 comments on commit cfb1a62

Please sign in to comment.