Skip to content

Latest commit

 

History

History

ruby

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Parts Of Speech API - Ruby Gem

Parts Of Speech extracts words from text based on grammatical categories like nouns, verbs, and adjectives. Pass any text passage and a category to receive an array of matching words.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_partsofspeech'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_partsofspeech

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_partsofspeech'

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

# Make a request
response = client.execute({
  text: "My friend from college hails from a small countryside village located at the heart of the state. During the last summer vacation, I had an opportunity to visit my friend in his village. I packed up my belongings and boarded the bus bound for the village",
  partofspeech: "verbs"
})

# Print the response
puts response

Error Handling

begin
  response = client.execute({ text: "My friend from college hails from a small countryside village located at the heart of the state. During the last summer vacation, I had an opportunity to visit my friend in his village. I packed up my belongings and boarded the bus bound for the village", partofspeech: "verbs" })
  puts response["data"]
rescue APIVerve::Partsofspeech::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Partsofspeech::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "partofspeech": "verbs",
    "result": [
      "located",
      "had",
      "visit",
      "packed up",
      "boarded",
      "bound"
    ],
    "count": 6
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.