Skip to main content

An open-source Python library for data cleaning tasks. Includes profanity detection, and removal. Now includes offensive language and hate speech detection using an AI model.

Project description

ValX

Python Version Code Size Downloads License Compliance PyPI Version

An open-source Python library for data cleaning tasks. It includes functions for profanity detection, and removal, and detection and removal of personal information. Also includes hate speech and offensive language detection and removal, using AI.

[!IMPORTANT] Please downgrade to numpy version 1.26.4. Our ValX DecisionTreeClassifier AI model, relies on lower versions of numpy, because it was trained on these versions. For more information see: https://techoverflow.net/2024/07/23/how-to-fix-numpy-dtype-size-changed-may-indicate-binary-incompatibility-expected-96-from-c-header-got-88-from-pyobject/

Changes in 0.2.3

We have introduced a new optional info_type parameter into our detect_sensitive_information, and remove_sensitive_information functions, to allow you to have fine-grained control over what sensitive information you want to detect or remove.

Also introduced more detection patterns for other types of sensitive information, including:

  • "iban": International Bank Account Number.
  • "mrn": Medical Record Number (may not work correctly, depending on provider and country).
  • "icd10": International Classification of Diseases, Tenth Revision.
  • "geo_coords": Geo-coordinates (latitude and longitude in decimal degrees format).
  • "username": Username handles (@username).
  • "file_path": File paths (general patterns for both Windows and Unix paths).
  • "bitcoin_wallet": Cryptocurrency wallet address.
  • "ethereum_wallet": Cryptocurrency wallet addresses.

Changes in 0.2.2

We have refactored and changed the detect_profanity function:

  • Removed unnecessary printing
  • Now returns more information about each found profanity, including Line, Column, Word, and Language.

[!NOTE] You can view ValX's package documentation for more information on changes.

Changes in 0.2.1

Using the AI models in ValX, you can now automatically remove hate speech, or offensive speech from your text data, without needing to run detection and write your own custom implementation method.

Installation

You can install ValX using pip:

pip install valx

Supported Python Versions

ValX supports the following Python versions:

  • Python 3.6
  • Python 3.7
  • Python 3.8
  • Python 3.9
  • Python 3.10
  • Python 3.11/Later (Preferred)

Please ensure that you have one of these Python versions installed before using ValX. ValX may not work as expected on lower versions of Python than the supported.

Features

  • Profanity Detection: Detect profane and NSFW words or terms.
  • Remove Profanity: Remove profane and NSFW words or terms.
  • Detect Sensitive Information: Detect sensitive information in text data.
  • Remove Sensitive Information: Remove sensitive information from text data.
  • Detect Hate Speech: Detect hate speech or offensive speech in text, using AI.
  • Remove Hate Speech: Remove hate speech or offensive speech in text, using AI.

List of supported languages for profanity detection and removal

Below is a complete list of all the available supported languages for ValX's profanity detection and removal functions which are valid values for language:

  • All
  • Arabic
  • Czech
  • Danish
  • German
  • English
  • Esperanto
  • Persian
  • Finnish
  • Filipino
  • French
  • French (CA)
  • Hindi
  • Hungarian
  • Italian
  • Japanese
  • Kabyle
  • Korean
  • Dutch
  • Norwegian
  • Polish
  • Portuguese
  • Russian
  • Swedish
  • Thai
  • Klingon
  • Turkish
  • Chinese

Usage

Detect Profanity

from valx import detect_profanity

# Detect profanity
results = detect_profanity(sample_text, language='English')
print("Profanity Evaluation Results", results)

Remove Profanity

from valx import remove_profanity

# Remove profanity
removed = remove_profanity(sample_text, "text_cleaned.txt", language="English")

Detect Sensitive Information

from valx import detect_sensitive_information

# Detect sensitive information
detected_sensitive_info = detect_sensitive_information(sample_text)

[!NOTE] We have updated this function, and it now includes an optional argument for info_type, which can be used to detect only specific types of sensitive information. It was also added to remove_sensitive_information.

Remove Sensitive Information

from valx import remove_sensitive_information

# Remove sensitive information
cleaned_text = remove_sensitive_information(sample_text2)

Detect Hate Speech And Offensive Language

from valx import detect_hate_speech

# Detect hate speech or offensive language
outcome_of_detection = detect_hate_speech("You are stupid.")

[!IMPORTANT] The model's possible outputs are:

  • ['Hate Speech']: The text was flagged and contained hate speech.
  • ['Offensive Speech']: The text was flagged and contained offensive speech.
  • ['No Hate and Offensive Speech']: The text was not flagged for any hate speech or offensive speech.

[!NOTE] See our official documentation for more examples on how to use ValX.

Contributing

Contributions are welcome! If you encounter any issues, have suggestions, or want to contribute to ValX, please open an issue or submit a pull request on GitHub.

License

ValX is released under the terms of the MIT License (Modified). Please see the LICENSE file for the full text.

Derived licenses


ValX uses data from this GitHub repository: https://github.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words/ © 2012-2020 Shutterstock, Inc.

Creative Commons Attribution 4.0 International License: https://github.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words/blob/master/LICENSE


Modified License Clause

The modified license clause grants users the permission to make derivative works based on the ValX software. However, it requires any substantial changes to the software to be clearly distinguished from the original work and distributed under a different name.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

valx-0.2.3.tar.gz (356.2 kB view details)

Uploaded Source

Built Distribution

valx-0.2.3-py3-none-any.whl (352.6 kB view details)

Uploaded Python 3

File details

Details for the file valx-0.2.3.tar.gz.

File metadata

  • Download URL: valx-0.2.3.tar.gz
  • Upload date:
  • Size: 356.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for valx-0.2.3.tar.gz
Algorithm Hash digest
SHA256 bb2ec3e19d2b212cf91bcceb653f6f8cb00a658980cd10c219b316f96cb312b6
MD5 05495fdcd6a6ba4598195bf96a58c427
BLAKE2b-256 092eadf7f9b467a71fa76b85b566d2ec0e4994fbb050489e8bed689b4803246f

See more details on using hashes here.

File details

Details for the file valx-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: valx-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 352.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for valx-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b994952acf1a87737bbbf3d0eaf38b788aee18b70792407e9b700a0dab9d75ff
MD5 29e7e29a839d32c3b1901d94af4c5013
BLAKE2b-256 c3f38f73883e15b881972d9d8f7b4bd82f5d1f9d6c8ad699c0f8924b30f4b4ac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page