Spell Checker API - Ruby Gem

Spell Checker is a simple tool for checking spelling in a given body of text. It returns correction suggestions

Installation

Add this line to your application's Gemfile:

gem 'apiverve_spellchecker'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_spellchecker

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_spellchecker'

# Initialize the client
client = APIVerve::Spellchecker::Client.new(api_key: "YOUR_API_KEY")

# Make a request
response = client.execute({ text: "I neeed to call my friend on telephine today!" })

# Print the response
puts response

Error Handling

begin
  response = client.execute({ text: "I neeed to call my friend on telephine today!" })
  puts response["data"]
rescue APIVerve::Spellchecker::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Spellchecker::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

# Enable debug logging
client = APIVerve::Spellchecker::Client.new(
  api_key: "YOUR_API_KEY",
  debug: true
)

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "spellPass": false,
    "mispellingsFound": 2,
    "corrections": [
      {
        "word": "neeed",
        "suggestions": [
          "needed",
          "need",
          "needy",
          "Neel",
          "needs"
        ]
      },
      {
        "word": "telephine",
        "suggestions": [
          "telephone",
          "telephoned",
          "telephoner",
          "telephones",
          "telephony"
        ]
      }
    ]
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.