Text Analysis API SDKs | AYLIEN

Text Analysis SDKs

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.

Looking to integrate with AYLIEN Text Analysis API?

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

With our documentation and SDKs you’ll be up and running in minutes

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
                        

You can then import and initiate the SDK easily:

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);
    }
});
                        

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
                        

You can then import and initiate the SDK easily:

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

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.*"
    }
}
                        

You can then import and initiate the SDK easily:

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

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
                        

You can then import and initiate the SDK easily:

require 'aylien_text_api'

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

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

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:

Using Maven:

<‌dependency>
<‌groupId>com.aylien.textapi<‌/groupId>
<‌artifactId>client<‌/artifactId>
<‌version>0.6.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());
    }
}
                        

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

Installation:

$ go get github.com/AYLIEN/aylien_textapi_go
                        

You can then import and initiate the SDK easily:

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)
}
                        

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
                        

You can then import and initiate the SDK easily:

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);
        }
    }
}