Skip to main content

A simple hate speech detection model using machine learning.

Project description

Hate Speech Detector

A lightweight Python package to detect hate speech in text using a machine learning model.

This project was developed by [Jahfar Muhammed]as part of my major project in college to explore ethical AI applications and contribute to safer digital communication. It uses traditional NLP preprocessing and a trained machine learning model to classify whether input text contains hate speech.

Features

  • Simple API with a single function call
  • Returns human-readable and structured results
  • Trained on real-world datasets
  • Easily integrable with chat apps, moderation systems, and content filters

Installation

You can install this package using pip:

pip install hate_speech_detector

Usage

Here's how you can use the package in your code:

from hate_speech_detector import isHate
result = isHate("I hate you!")
print(result)
# Output: {'message': 'Hate Speech', 'isHate': True}
result = isHate("Have a nice day!")
print(result)
# Output: {'message': 'Not Hate Speech', 'isHate': False}

Function Description

  • isHate(text: str) -> dict
  • Input: A string of text
  • Output: A dictionary with:
  • message: "Hate Speech" or "Not Hate Speech"
  • isHate: True if hate speech, else False

Project Information

This package was developed as a college major project with the goal of creating a practical ethical and easy-to-use tool for identifying hate speech in textual content. It combines text preprocessing machine learning, and Python packaging into a useful open-source solution.

Author

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

hate_speech_detector-0.2.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hate_speech_detector-0.2.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file hate_speech_detector-0.2.1.tar.gz.

File metadata

  • Download URL: hate_speech_detector-0.2.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for hate_speech_detector-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c959145fb7b192246e6a71c64910dd8e809c9190ab6f98f658ff7bdbeddf437b
MD5 3eba1d5c932e6e9056c7cd8a070b8e98
BLAKE2b-256 e38f720f348cbbc05b673aad2880594ac55199105e9eb20a9a8831588d868cfb

See more details on using hashes here.

File details

Details for the file hate_speech_detector-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hate_speech_detector-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2aa0e0225ffaf5fdda37ccae161bedd7a0f6b0e18703bd9319e85af53d13ae85
MD5 e9638fd9adea979a18397436b461e44c
BLAKE2b-256 91ee89dd43a0b2ca011b4df86035a263f995ccbe419ab9fe91cb95d022c9d7d9

See more details on using hashes here.

Supported by

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