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.2.0.tar.gz (7.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.2.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gemini_profanity_filter-0.2.0.tar.gz
  • Upload date:
  • Size: 7.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.2.0.tar.gz
Algorithm Hash digest
SHA256 105a703d5448a039ab097b1ee527d911df30bb9d4933481eb1882e025b9c72ad
MD5 f6061a6694456f3179d689cf9cb2a5fc
BLAKE2b-256 b2e38a7e4a61f2c3d7219ed6df55cb6bd6f2b5d36d40008909f53024723d2bc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gemini_profanity_filter-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 834669e38262f518d502bd54ea856208cbe0d44e1ac429e3c82379e0607965e9
MD5 0b65724eba13396683b7324747c37507
BLAKE2b-256 40425d1a83fe57ed0e9c878e1b3995e18f9cd0c544373e844660742c3312b026

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