Remove Punctuation API - Ruby Gem
Remove Punctuation is a simple tool for removing punctuation marks from text. It strips all common punctuation characters and provides statistics about what was removed.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_removepunctuation'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_removepunctuation
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_removepunctuation'
# Initialize the client
client = APIVerve::Removepunctuation::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({ text: "Hello, world! How are you doing today? I'm great - thanks for asking. This text has lots of punctuation: periods, commas, hyphens & more!" })
# Print the response
puts response
Error Handling
begin
response = client.execute({ text: "Hello, world! How are you doing today? I'm great - thanks for asking. This text has lots of punctuation: periods, commas, hyphens & more!" })
puts response["data"]
rescue APIVerve::Removepunctuation::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Removepunctuation::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Removepunctuation::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"cleaned": "Hello world How are you doing today Im great thanks for asking This text has lots of punctuation periods commas hyphens more",
"punctuation_removed": [
"!",
"&",
"'",
",",
"-",
".",
":",
"?"
],
"count": 11
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/removepunctuation?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.