Looking to integrate with AYLIEN Text Analysis API ?

To make things as easy as possible, we have a number of SDKs you can import into your development environment to get up and running quickly.

Our SDKs are built on AYLIEN Text Analysis API and are the easiest and quickest way to bring the power of Text Analytics to your App.

Install AYLIEN Text Analysis SDKs

Python

Visit our GitHub page to download our Python SDK repo, or you can run an example with the code below:

Installation:

$ pip install --upgrade aylien-apiclient

Example:

from aylienapiclient import textapi
c = textapi.Client("YourAppID", "YourAppKey")
s = c.Sentiment({'text': 'John is a very good football player!'})

Node.js

Visit our GitHub page to download our Node.js SDK repo, or you can run an example with the code below:

Installation:

$ npm install aylien_textapi

Example:

var AYLIENTextAPI = require('aylien_textapi');
var textapi = new AYLIENTextAPI({
  application_id: "YourAppId",
  application_key: "YourAppKey"
});
textapi.sentiment({
  'text': 'John is a very good football player!'
}, function(error, response) {
  if (error === null) {
    console.log(response);
  }
});

Ruby

Visit our GitHub page to download our Ruby SDK repo, or you can run an example with the code below:

Installation:

$ gem install aylien_text_api

Example:

require 'aylien_text_api'

client = AylienTextApi::Client.new(app_id: "YourAppId",
  app_key: "YourAppKey")

client.sentiment text: "John is a very good football player!"

PHP

Visit our GitHub page to download our PHP SDK repo, or you can run an example with the code below:

Installation:

Simply add the following to your composer.json:

{
  "require": {
    "aylien/textapi": "0.1.*"
  }
}

Example:

$textapi = new AYLIEN\TextAPI("YourAppId", "YourAppKey");
$sentiment = $textapi->Sentiment(array(
  'text' => 'John is a very good football player!'
));

Java

Visit our GitHub page to download our Java SDK repo, or you can run an example with the code below:

Installation:

Since the Text Analysis API is published to Maven Central, it is enough to add the dependency to the POM:

<dependency>
  <groupId>com.aylien.textapi</groupId>
  <artifactId>client</artifactId>
  <version>0.1.0</version>
</dependency>

And for SBT users:

"com.aylien.textapi" % "client" % "0.1.0"

Example:

import com.aylien.textapi.TextAPIClient;
import com.aylien.textapi.parameters.*;
import com.aylien.textapi.responses.*;
import java.net.URL;

class Example {
  public static void main(String[] args) throws Exception {
    TextAPIClient client = new TextAPIClient(
        "YourApplicationId", "YourApplicationKey");
    URL url = new URL(
        "http://www.bbc.com/news/science-environment-30097648");
    ConceptsParams.Builder builder = ConceptsParams.newBuilder();
    builder.setUrl(url);
    Concepts concepts = client.concepts(builder.build());
    System.out.println(concepts.getText());
    for (Concept c: concepts.getConcepts()) {
      System.out.print(c.getUri() + ": ");
      for (SurfaceForm sf: c.getSurfaceForms()) {
        System.out.print(sf.getString() + " ");
      }
      System.out.println();
    }

    LanguageParams languageParams = new LanguageParams(null, url);
    Language language = client.language(languageParams);
    System.out.printf("\nLanguage is: %s (%f)\n",
        language.getLanguage(), language.getConfidence());
  }
}

Go

Visit our GitHub page to download our Go SDK repo, or you can run an example with the code below:

Installation:

The easiest way to get the Go SDK is to use go get:

$ go get github.com/AYLIEN/aylien_textapi_go

Example:

package main

import (
    "fmt"
    textapi "github.com/AYLIEN/aylien_textapi_go"
)

func main() {
    auth := textapi.Auth{"YourApplicationId", "YourApplicationKey"}
    client, err := textapi.NewClient(auth, true)
    if err != nil {
        panic(err)
    }
    text := "John is a very good football player!"
    sentimentParams := &textapi.SentimentParams{Text: text}
    sentiment, err := client.Sentiment(sentimentParams)
    if err != nil {
        panic(err)
    }
    fmt.Printf("%v\n", sentiment)
    languageParams := &textapi.LanguageParams{Text: text}
    language, err := client.Language(languageParams)
    if err != nil {
        panic(err)
    }
    fmt.Printf("%v\n", language)
}

C#

Visit our GitHub page to download our C# SDK repo, or you can run an example with the code below:

Installation:

The easiest way to get the C# SDK is to use NuGet.

PM> Install-Package Aylien.TextApi

Example:

using Aylien.TextApi;
using System;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            Client client = new Client(
                "YourApplicationID", "YourApplicationKey");
            Sentiment sentiment = client.Sentiment(
                text: "John is a very good football player!");
            Language language = client.Language(
                text: "John is a very good football player!");

            Console.WriteLine("Sentiment: {0} ({1})", 
                sentiment.Polarity, sentiment.PolarityConfidence);
            Console.WriteLine("Language: {0} ({1})",
                language.Lang, language.Confidence);
        }
    }
}