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 C#

Requirements

  • C# (>= 4.0)

Getting the SDK

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

PM> Install-Package Aylien.TextApi

Using the SDK

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

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