Word Lexicon Analyzer API - Ruby Gem

Lexicon is a simple tool for analyzing words. It returns various properties of the word.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_lexicon'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_lexicon

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_lexicon'

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

# Make a request
response = client.execute({ word: "listen" })

# Print the response
puts response

Error Handling

begin
  response = client.execute({ word: "listen" })
  puts response["data"]
rescue APIVerve::Lexicon::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Lexicon::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "word": "listen",
    "isAlphagram": false,
    "sortedForm": "eilnst",
    "isPalindrome": false,
    "hasAnagram": false,
    "isIsogram": true,
    "isPangramCandidate": false,
    "isScrabbleValid": true,
    "canBePalindromeAnagram": false
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.