Profanity Filter API - Ruby Gem
Profanity Filter is a simple tool for filtering out profanity words from a text. It returns the text with the profanity words replaced by placeholders.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_profanityfilter'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_profanityfilter
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_profanityfilter'
# Initialize the client
client = APIVerve::Profanityfilter::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
text: "Today is so damn hot! Why the hell would anyone go outside?",
mask: "*"
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ text: "Today is so damn hot! Why the hell would anyone go outside?", mask: "*" })
puts response["data"]
rescue APIVerve::Profanityfilter::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Profanityfilter::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Profanityfilter::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"isProfane": true,
"filteredText": "Today is so **** hot! Why the **** would anyone go outside?",
"mask": "*",
"trimmed": false,
"profaneWords": 2
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://profanityfilter.apiverve.com?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.