Skip to main content

A Python module for detecting and filtering profanity using Google's Gemini API

Project description

Gemini Profanity Filter

A Python module for detecting and filtering profanity in text using Google's Gemini API. The module can identify standard and obfuscated profanity across multiple languages.

Features

  • Detects standard profanity in multiple languages
  • Identifies obfuscated profanity (character substitutions, leetspeak, etc.)
  • Handles stretched or repeated characters
  • Detects deliberately fragmented words
  • Works with mixed case patterns
  • Processes context-sensitive profanity
  • Language-specific profanity patterns including Cyrillic, Asian scripts, etc.

Installation

pip install gemini-profanity-filter

Usage

from gemini_profanity_filter import ProfanityFilter

# Initialize with your API key
filter = ProfanityFilter(api_key="your_api_key")

# Filter text
result = filter.filter_text("Text to be filtered")

# Access results
if result:
    print(f"Filtered text: {result.filtered_text}")
    print(f"Detected profanity instances: {result.detected_count}")
    
    # Print details about detected instances
    for instance in result.detected_profanity:
        print(f"Original form: {instance.original_form}")
        print(f"Normalized form: {instance.normalized_form}")
        print(f"Detection method: {instance.detection_method}")
        print(f"Confidence score: {instance.confidence_score}")
    
    # Get detected languages
    print(f"Languages detected: {', '.join(result.languages_detected)}")

Requirements

  • Python 3.7 or higher
  • Google GenerativeAI Python library
  • A valid Google Gemini API key

License

MIT

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

gemini_profanity_filter-0.1.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

gemini_profanity_filter-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file gemini_profanity_filter-0.1.0.tar.gz.

File metadata

  • Download URL: gemini_profanity_filter-0.1.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for gemini_profanity_filter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aee49664f715b01301c352ee6d61f18d87232e93abdb9eec750329d983c1993e
MD5 d5c05a70b91c0c2d91ab7e080b192e62
BLAKE2b-256 1a21c1341f238992591e9a6feae54c4b76de9bc649ed02abce1a4a91034a2664

See more details on using hashes here.

File details

Details for the file gemini_profanity_filter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gemini_profanity_filter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c57974cf04bf78c30c1f428a779e0d9c0154700cf29555b8ce78d417eac6a4b7
MD5 2c194949176f4d3e3981aa4c6d67d375
BLAKE2b-256 ac3915c06c2a69814950aa5b4b42ef16a13101dfb8dd643c924d375af0b14126

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