Get Your API Credentials

If you haven't already done so, you will need to sign up.

Sign up to our free plan here: developer.aylien.com/signup.

The Free plan allows you to make 1,000 calls/day for free. For further information on paid plans please visit our plans page.

Getting Started with AYLIEN Text Analysis API Using Python

Requirements

  • Python

Getting the SDK

The easiest way to get the Python SDK is to use pip or easy_install.

$ pip install --upgrade aylien-apiclient

or

$ easy_install --upgrade aylien-apiclient

Using the SDK

The following example demonstrates how to calculate the sentiment of a simple sentence, and determine the language it's written in.

from aylienapiclient import textapi

text = "John is a very good football player!"
client = textapi.Client("YourApplicationID", "YourApplicationKey")
sentiment = client.Sentiment({"text": text})
language = client.Language({"text": text})

print("Sentiment: %s (%f)\nLanguage: %s (%f)" %
    (sentiment['polarity'], sentiment['polarity_confidence'],
      language['lang'], language['confidence']))