Get Your API Credentials

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

Sign up to our free plan here:

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 Go


Getting the SDK

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

$ go get

Using the SDK

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

package main

import (
    textapi ""

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