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.1.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.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hate_speech_detector-0.1.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.1.1.tar.gz
Algorithm Hash digest
SHA256 04a016e84242a0462c2778edc6741a5755dcaf49c330c53665147ef4244fe5bb
MD5 53dc9c074f560295519c2f12c81f0e8a
BLAKE2b-256 f29d4de23df8684c1ca6ecef51cbafeaaad61e29c6f95217596511ca07578ea8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hate_speech_detector-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2f6f52e621321a2a3e756a1fa35cd339d3eb140720eb4782c133855af843b5f
MD5 517bf26699246c1c08214905a0d1929e
BLAKE2b-256 77ec9714ccba5b8e3392817e7203f58b1016da5b675c36922795fc2f1451d4b5

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