Our Profanity Filter API provides a sophisticated tool for detecting and filtering profane language in text across various platforms. Using cutting-edge algorithms, the API moderates content in real time by identifying and replacing offensive words with customizable placeholders. This service is ideal for a range of applications, from social media to customer support, ensuring a professional and clean communication environment. Integration is straightforward, backed by comprehensive documentation and dedicated developer support.
1. Detect Profanity in Text
This example demonstrates how to check if a string contains profanity. If profanity is detected, the response will be true
.
import requests
url = "https://profanity-filter3.p.rapidapi.com/contains_profanity"
headers = {
"content-type": "application/json",
"X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
"X-RapidAPI-Host": "profanity-filter3.p.rapidapi.com"
}
payload = "Text To Filter"
response = requests.put(url, data=payload, headers=headers)
print(response.json())
Response Example:
{
"Contains_Profanity": false
}
2. Filter Profanity from Text
This example demonstrates how to filter out profanity from a string, replacing any profane words with asterisks (***).
import requests
url = "https://profanity-filter3.p.rapidapi.com/filter_profanity"
headers = {
"content-type": "application/json",
"X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
"X-RapidAPI-Host": "profanity-filter3.p.rapidapi.com"
}
payload = "text to filter"
response = requests.put(url, data=payload, headers=headers)
print(response.json())
Response Example:
{
"Filtered Text": "text to filter"
}
Ensure you replace "YOUR_RAPIDAPI_KEY"
with your actual RapidAPI key to authenticate requests successfully.