{"id":8822,"library":"alt-profanity-check","title":"Alt Profanity Check","description":"Alt Profanity Check is a fast, robust Python library designed to detect offensive language in strings, serving as a drop-in replacement for the unmaintained `profanity-check` library. It utilizes a linear Support Vector Machine (SVM) model trained on a large dataset of human-labeled text. The library is actively maintained, with frequent updates that align with its primary dependency, `scikit-learn`. The current version is 1.8.0, supporting Python 3.11 and newer.","status":"active","version":"1.8.0","language":"python","source_language":"en","source_url":"https://github.com/dimitrismistriotis/alt-profanity-check","tags":["natural language processing","nlp","profanity detection","text analysis","machine learning","moderation"],"install":[{"cmd":"pip install alt-profanity-check","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Core machine learning library for the SVM model. Version 1.8.0 of alt-profanity-check specifically requires scikit-learn==1.8.0.","package":"scikit-learn","optional":false},{"reason":"Used for efficient loading/saving of the pre-trained model. Version 1.8.0 of alt-profanity-check specifically requires joblib==1.5.3.","package":"joblib","optional":false}],"imports":[{"note":"Despite the package name being 'alt-profanity-check', it is a drop-in replacement for 'profanity-check' and maintains the original internal module structure for imports.","wrong":"from alt_profanity_check import predict","symbol":"predict","correct":"from profanity_check import predict"},{"note":"The library is designed as a drop-in replacement for 'profanity-check', hence imports are from 'profanity_check' internally.","wrong":"from alt_profanity_check import predict_prob","symbol":"predict_prob","correct":"from profanity_check import predict_prob"}],"quickstart":{"code":"from profanity_check import predict, predict_prob\n\n# Predict profanity (returns 1 for profane, 0 for clean)\ntexts = ['hello world', 'go to hell', 'this is a bad word']\npredictions = predict(texts)\nprint(f\"Predictions: {predictions}\")\n\n# Predict probability of profanity\nprobabilities = predict_prob(texts)\nprint(f\"Probabilities: {probabilities}\")","lang":"python","description":"This example demonstrates how to import and use the `predict` and `predict_prob` functions to check a list of strings for offensive language and get their respective profanity probabilities."},"warnings":[{"fix":"Ensure your Python environment meets the `python_requires` specification for the `alt-profanity-check` version you are installing. For v1.8.0, use Python 3.11 or newer. For older Python versions, pin `alt-profanity-check` to an earlier compatible version (e.g., v1.7.x for Python >=3.10, v1.4.x for Python >=3.8).","message":"Python version requirements have changed significantly across minor versions of `alt-profanity-check` due to its tight coupling with `scikit-learn` dependencies. For `alt-profanity-check` v1.8.0, Python >= 3.11 is strictly required.","severity":"breaking","affected_versions":">=1.5.0"},{"fix":"Always use `from profanity_check import ...` in your code, even though the installed package name is `alt-profanity-check`.","message":"The library is installed via `pip install alt-profanity-check`, but imports use the original module name `profanity_check` (e.g., `from profanity_check import predict`). This is by design, as it's a drop-in replacement.","severity":"gotcha","affected_versions":"all"},{"fix":"Always install `alt-profanity-check` in a clean virtual environment to ensure its `scikit-learn` and `joblib` dependencies are correctly installed and matched. Avoid manually upgrading `scikit-learn` independently of `alt-profanity-check`.","message":"Major underlying dependency (`scikit-learn`) version upgrades can introduce breaking changes. `alt-profanity-check` explicitly pins `scikit-learn` versions per release. Mismatched `scikit-learn` versions between what `alt-profanity-check` expects and what is installed in your environment can lead to runtime errors or incorrect predictions.","severity":"breaking","affected_versions":"all"}],"env_vars":null,"search_vec":"'1.8.0':74 '3.11':77 'activ':56 'align':62 'alt':1,4 'analysi':87 'check':3,6,32 'current':71 'dataset':47 'depend':66 'design':13 'detect':15,85 'drop':24 'drop-in':23 'fast':9 'frequent':59 'human':50 'human-label':49 'label':51 'languag':17,81 'larg':46 'learn':69,89 'librari':12,33,54 'linear':37 'machin':40,88 'maintain':57 'model':42 'moder':90 'natur':80 'newer':79 'nlp':83 'offens':16 'primari':65 'process':82 'profan':2,5,31,84 'profanity-check':30 'python':11,76 'replac':26 'robust':10 'scikit':68 'scikit-learn':67 'serv':20 'string':19 'support':38,75 'svm':41 'text':52,86 'train':43 'unmaintain':29 'updat':60 'util':35 'vector':39 'version':72","created_at":"2026-04-16T18:47:02.363689+00:00","updated_at":"2026-04-16T18:47:02.363689+00:00","problems":[{"fix":"Ensure `alt-profanity-check` is installed in your active Python environment using `pip install alt-profanity-check`.","cause":"The `alt-profanity-check` library is not installed, or Python cannot find the installed package.","error":"ModuleNotFoundError: No module named 'profanity_check'"},{"fix":"Reinstall `alt-profanity-check` in a fresh virtual environment to ensure all dependencies are correctly resolved: `python -m venv .venv && source .venv/bin/activate && pip install alt-profanity-check`.","cause":"This typically occurs if `alt-profanity-check` failed to install correctly or its internal data files (`model.joblib`, `vectorizer.joblib`) are missing/corrupted, often due to dependency conflicts with `scikit-learn` or `joblib`.","error":"AttributeError: module 'profanity_check' has no attribute 'predict'"},{"fix":"Upgrade your Python environment to 3.11 or newer, or downgrade `alt-profanity-check` to a version compatible with your current Python (e.g., `pip install alt-profanity-check==1.7.2` for Python 3.10).","cause":"You are trying to use `alt-profanity-check` v1.8.0 (or newer) with an unsupported Python version. `alt-profanity-check` v1.8.0 requires Python >= 3.11.","error":"RuntimeError: Python version 3.10.x is not supported by scikit-learn 1.8.0"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.9.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/dimitrismistriotis/alt-profanity-check","docs":null,"changelog":null,"pypi":"https://pypi.org/project/alt-profanity-check/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}