Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unused dependency, handle ImportError #3447

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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