Experimental project

This is a sandbox project, which contains experimental code for developer use only.

This module provides a wrapper around the aylien_textapi_php library and provides simplified access to the Aylien API endpoints. It does not provide a user interface to access endpoints directly and is designed to be used by other modules that need to call the Aylien API.

Aylien API

AYLIEN Text Analysis API is a package of Natural Language Processing and Machine Learning-powered tools for analyzing and extracting various kinds of information from text and images.

You can sign up to a free account account which provides full API access but it limited to 1000 calls per day.

Module features

Features include:

  • Aylien application ID and key settings from the Configuration > Web service > Aylien API Settings form.
  • Calls to the Aylien API via a single function call: aylien_api_call($method, $params).
  • The function call aylien_api_rate_limits() which provides usage and limit information.

How to install

  1. Install the Libraries API module.
  2. Download and unpack the aylien_textapi_php library to a directory called aylien_textapi_php under your /sites/all/libraries directory.
  3. Enable the Aylien API module.

How to use

This module provides developers with a simplified way to connect to the Aylien endpoints.

Once you have your Application ID and key entered into the Aylien API settings form you can access the various endpoints by calling aylien_api_call('endpoint', $params) passing in the name of the endpoint as the first parameter and the endpoint parameters as the second.

$result = aylien_api_call('Sentiment', $body_text); 

$polarity = $result->polarity;
$subjectivity = $result->subjectivity;

To return the usage and rate limits for the current app ID call:

$result = aylien_api_rate_limits();

drupal_set_message("Calls remaining !remaining", array('!remaining' => $result['remaining']));

This will return an array with the keys 'limit', 'remaining' and 'reset'.

Project information