vzhou842 / profanity-check

A fast, robust Python library to check for offensive language in strings.
https://pypi.org/project/profanity-check
MIT License
630 stars 117 forks source link

ImportError: Cannot import name ‘joblib’ from ‘sklearn.externals #52

Closed htnphu closed 2 months ago

htnphu commented 2 months ago

Hello,

I'm encountering an issue while trying to use the profanity_check library in Python. Upon importing profanity_check, I'm receiving the following error:

Traceback (most recent call last): File “path/to/your/script.py”, line X, in from profanity_check import predict, predict_prob File “path/to/venv/lib/pythonX.X/site-packages/profanity_check/init.py”, line X, in from .profanity_check import predict, predict_prob File “path/to/venv/lib/pythonX.X/site-packages/profanity_check/profanity_check.py”, line X, in from sklearn.externals import joblib ImportError: cannot import name ‘joblib’ from ‘sklearn.externals’ (path/to/venv/lib/pythonX.X/site-packages/sklearn/externals/init.py)

It seems that profanity_check is relying on joblib from sklearn.externals, which has been removed in newer versions of scikit-learn.

Could you please advise on how to resolve this issue? Alternatively, could the library be updated to use joblib directly or provide compatibility with newer versions of scikit-learn?

Thank you for your assistance.

Best regards, htnphu

htnphu commented 2 months ago

Hello,

I have found a solution to the issue. There is a forked repository called alt-profanity-check that addresses the import problem with joblib. This repository is a drop-in replacement for profanity-check and aims to maintain compatibility with newer versions of scikit-learn.

You guys can find the alt-profanity-check repository here: https://github.com/dimitrismistriotis/alt-profanity-check

Best regards, htnphu