Keyword Extractor API - Ruby Gem
Keyword Extractor is a simple tool for extracting keywords from a web page. It returns the keywords and the frequency of each keyword.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_keywordextractor'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_keywordextractor
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_keywordextractor'
# Initialize the client
client = APIVerve::Keywordextractor::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({ url: "https://en.wikipedia.org/wiki/Email_address" })
# Print the response
puts response
Error Handling
begin
response = client.execute({ url: "https://en.wikipedia.org/wiki/Email_address" })
puts response["data"]
rescue APIVerve::Keywordextractor::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Keywordextractor::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Keywordextractor::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"url": "https://en.wikipedia.org/wiki/Email_address",
"keywordCount": 50,
"topKeyword": "email",
"totalOccurrences": 672,
"keywords": {
"email": 94,
"address": 61,
"mail": 52,
"domain": 34,
"addresses": 34,
"characters": 27,
"retrieved": 27,
"internet": 17,
"message": 15,
"validation": 12
},
"topKeywords": [
{
"keyword": "email",
"count": 94,
"percentage": 14
},
{
"keyword": "address",
"count": 61,
"percentage": 9.1
},
{
"keyword": "mail",
"count": 52,
"percentage": 7.7
},
{
"keyword": "domain",
"count": 34,
"percentage": 5.1
},
{
"keyword": "addresses",
"count": 34,
"percentage": 5.1
}
]
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/keywordextractor?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.