This library allows you to easily use the Magnet API via Ruby.
Table of Contents
- About
- Installation
- Usage
About
Klangoo NLP API is a natural language processing (NLP) service that uses the rule-based paradigm and machine learning to recognize the aboutness of text. The service recognizes the category of the text, extracts key disambiguated topics, places, people, brands, events, and 41 other types of names; analyzes text using tokenization, parts of speech, parsing, word sense disambiguation, named entity recognition; and automatically finds the relatedness score between documents.
Installation
Prerequisites
Install
Install using gem:
gem install magnetapiclient
Install manually:
Download and add to your project the file magnetapiclient.rb
Usage
This quick start tutorial will show you how to process a text.
Initialize the client
To begin, you will need to initialize the client. In order to do this you will need your API Key CALK and Secret Key. You can find both on your Klangoo account.
require 'magnetapiclient' # installed using gem
#load 'magnetapiclient.rb' # installed manually
ENDPOINT ='https://nlp.klangoo.com/Service.svc'
CALK ='enter your calk here'
SECRET_KEY ='enter your secret key here'
$client = MagnetAPIClient.new(ENDPOINT, CALK, SECRET_KEY)
request = Hash[]
request["text"] = "Real Madrid transfer news"
request["lang"] = "en"
request["format"] = "json"
json = $client.callwebmethod('ProcessDocument', request, 'POST')