Blast off using our client libraries

At Lymbix, we want to make sure you spend your time building kick ass software. Because we want you to continue doing awesome work, we've taken the liberty of creating and maintaining API wrappers for some of the most popular programming languages so you don't have to.


API wrappers are available for Ruby, PHP, .NET, JavaScript and Python.


.NET

back to top
Installation

The .NET wrapper can be downloaded from GitHub.

Configuration

Begin by adding a reference to the Lymbix assembly to your project.

using Lymbix.ToneAPI;

An instance of the ToneAPI library can be initialized by passing an authentication key to its constructor.

ToneAPI lymbix = new ToneAPI(YOUR_AUTH_KEY);
Methods

The ToneAPI object exposes the following methods:

  • ArticleInfo[] TonalizeMultiple(List<string> articles, Dictionary<string, string> $options = null)
  • Tonalize multiple articles
  • ArticleInfo TonalizeDetailed(string article, Dictionary<string, string> options = null)
  • Tonalize an article
  • ArticleInfo Tonalize(string article, Dictionary<string, string> options = null)
  • Tonalize an article
  • string FlagResponse(string phrase, string apiMethod = null, string apiVersion = "2.2",
    string callbackUrl = null, Dictionary<string, string> options = null)
  • Flag a response as inaccurate
Example Code
using System;
using Lymbix.ToneAPI;
using Lymbix.ToneAPI.Models;

namespace Example
{
  class Program
  {
      static void Main(string[] args)
      {
          ToneAPI lymbix = new ToneAPI(YOUR_AUTH_KEY);
          Console.WriteLine(lymbix.TonalizeDetailed("Sally Sue doesn't like pebbles in her soup.").ArticleSentiment.SentimentType);
          Console.Read();
      }
  }
}
Example Output
Negative

Ruby

back to top
Installation

To install the Lymbix gem use the following command:

gem install lymbix

Note: The Lymbix gem requires the rest-client gem, version >= 1.4.2.

Configuration

An instance of the Lymbix gem can be initialized by passing an authentication key to its constructor.

lymbix = Lymbix::Base.new(YOUR_AUTH_KEY)

By default the gem is configured to use version 2.1 of the API, you can specify the version to use like so:

lymbix.api_version = 2.1
Methods

The Lymbix object exposes the following methods:

  • - (Object) tonalize(article, return_fields = nil, accept_type = nil, article_reference_id = nil)
  • Tonalize text using version 2.1, 2.2 of the API
  • - (Object) tonalize_article(article, accept_type = "application/json")
  • Tonalize text using version 2.0 of the API
  • - (Object) tonalize_detailed(article, return_fields = nil, accept_type = nil, article_reference_id = nil)
  • Tonalize an article using version 2.1 of the API
  • - (Object) tonalize_multiple(articles, return_fields = nil, accept_type = nil, article_reference_ids = nil)
  • Tonalize multiple articles using version 2.1 of the API
  • - (Object) flag_response(reference_id, phrase, api_method_requested, api_version, callback_url = nil)
  • Flags a phrase to be re-evaluated
Example Code
require 'lymbix'
lymbix = Lymbix::Base.new(YOUR_AUTH_KEY)
p lymbix.tonalize("I like ruby.")
Example Output
=> {"article"=>"I love Ruby!", "ignored_terms"=>["Ruby"], "affection_friendliness"=>6.38, "enjoyment_elation"=>2.18, "amusement_excitement"=>1.01, "contentment_gratitude"=>2.52, "sadness_grief"=>0.0, "anger_loathing"=>0.0, "fear_uneasiness"=>0.0, "humiliation_shame"=>0.0, "dominant_emotion"=>"affection_friendliness", "average_intensity"=>1.8, "article_sentiment"=>{"sentiment"=>"Positive", "score"=>0.76}, "coverage"=>40.0, "intense_sentence"=>{"sentence"=>"I love Ruby!", "dominant_emotion"=>"affection_friendliness", "intensity"=>6.4}, "clarity"=>41.96}

PHP

back to top
Installation

The PHP wrapper can be downloaded from GitHub.

Configuration

Begin by requiring the library in your script:

require_once 'Lymbix.php';

An instance of the Lymbix library can be initialized by passing an authentication key to its constructor.

$lymbix = new Lymbix(YOUR_AUTH_KEY);
Methods

The Lymbix object exposes the following methods:

  • TonalizeMultiple($articles, $options = null)
  • Tonalize multiple articles
  • TonalizeDetailed($article, $options = null)
  • Tonalize an article
  • Tonalize($article, $options = null)
  • Tonalize an article
  • FlagResponse($phrase, $apiMethod = null, $apiVersion = '2.2', $callbackUrl = null, $options = null)
  • Flag a response as inaccurate
Example Code
<?php
require_once 'Lymbix.php';
$lymbix = new Lymbix(YOUR_AUTH_KEY);
print_r($lymbix->TonalizeDetailed("I'm walking on sunshine... ooooooh, oh!"));
Example Output
stdClass Object ( [article] => I'm walking on sunshine... ooooooh, oh! [ignored_terms] => Array ( ) [affection_friendliness] => 0.33 [enjoyment_elation] => 1.52 [amusement_excitement] => 0.4 [contentment_gratitude] => 0.22 [sadness_grief] => -0.08 [anger_loathing] => -0.13 [fear_uneasiness] => -0.15 [humiliation_shame] => -0.15 [dominant_emotion] => enjoyment_elation [article_sentiment] => stdClass Object ( [sentiment] => Positive [score] => 7.85 ) [coverage] => 70 [intense_sentence] => stdClass Object ( [sentence] => ooooooh, [dominant_emotion] => amusement_excitement [intensity] => 2.8 ) [clarity] => 85.35 [sentences_data] => Array ( [0] => stdClass Object ( [sentence] => I'm walking on sunshine... [dominant_emotion] => enjoyment_elation [enjoyment_elation] => 1.19 [amusement_excitement] => 0.09 [contentment_gratitude] => 0.22 [sadness_grief] => -0.02 [anger_loathing] => -0.11 [fear_uneasiness] => -0.15 [humiliation_shame] => -0.13 [affection_friendliness] => 0.08 [sentence_sentiment] => stdClass Object ( [sentiment] => Positive [score] => 10 ) [ignored_terms] => Array ( ) [clarity] => 69.5 [coverage] => 20 ) [1] => stdClass Object ( [sentence] => ooooooh, [dominant_emotion] => amusement_excitement [enjoyment_elation] => 2.29 [amusement_excitement] => 2.79 [contentment_gratitude] => 1.9 [sadness_grief] => -0.16 [anger_loathing] => 0 [fear_uneasiness] => -0.36 [humiliation_shame] => 0 [affection_friendliness] => 0.17 [sentence_sentiment] => stdClass Object ( [sentiment] => Positive [score] => 10 ) [ignored_terms] => Array ( ) [clarity] => 80.1 [coverage] => 95 ) [2] => stdClass Object ( [sentence] => oh! [dominant_emotion] => amusement_excitement [enjoyment_elation] => 0.25 [amusement_excitement] => 1.07 [contentment_gratitude] => 0.73 [sadness_grief] => -0.2 [anger_loathing] => 0 [fear_uneasiness] => -0.03 [humiliation_shame] => 0 [affection_friendliness] => 0 [sentence_sentiment] => stdClass Object ( [sentiment] => Positive [score] => 10 ) [ignored_terms] => Array ( ) [clarity] => 80.78 [coverage] => 95 ) ) )

Python

back to top
Installation

The Python wrapper can be downloaded from GitHub.

Configuration

Begin by importing the library into your script:

from lymbix import Lymbix

An instance of the Lymbix library can be initialized by passing an authentication key to its constructor.

lymbix = Lymbix(YOUR_AUTH_KEY)
Methods

The Lymbix object exposes the following methods:

  • tonalize_multiple(self, articles, options = None)
  • Tonalize multiple articles
  • tonalize_detailed(self, article, options = None)
  • Tonalize an article
  • tonalize(self, article, options = None)
  • Tonalize an article
  • flag_response(self, phrase, api_method = None, api_version = '2.2', callback_url = None, options = None)
  • Flag a response as inaccurate
Example Code
from lymbix import Lymbix
lymbix = Lymbix('dfcad1488854c47dd26f30d3eb424c77e5606801')
print lymbix.tonalize_detailed("I can't stand all this snow anymore.")
Example Output
{'anger_loathing': -0.34, 'enjoyment_elation': 0.89, 'amusement_excitement': 0.57, 'contentment_gratitude': 2.79, 'humiliation_shame': -0.02, 'intense_sentence': {'dominant_emotion': 'contentment_gratitude', 'intensity': 2.8, 'sentence': "I can't stand all this snow anymore."}, 'fear_uneasiness': -0.01, 'ignored_terms': [], 'affection_friendliness': 0.31, 'coverage': 17.0, 'sentences_data': [{'dominant_emotion': 'contentment_gratitude', 'enjoyment_elation': 0.89, 'sentence': "I can't stand all this snow anymore.", 'amusement_excitement': 0.57, 'contentment_gratitude': 2.79, 'anger_loathing': -0.34, 'humiliation_shame': -0.02, 'fear_uneasiness': -0.01, 'sentence_sentiment': {'score': 10, 'sentiment': 'Positive'}, 'affection_friendliness': 0.31, 'coverage': 17.14, 'sadness_grief': -0.19, 'clarity': 74.18, 'ignored_terms': []}], 'sadness_grief': -0.19, 'article': "I can't stand all this snow anymore.", 'clarity': 74.18, 'article_sentiment': {'score': 4.9, 'sentiment': 'Positive'}, 'dominant_emotion': 'contentment_gratitude'}

JavaScript

back to top
Installation

The Javascript wrapper can be downloaded from GitHub.

Configuration

Begin by including the library in your script:

<script src="jquery.lymbix.js" type="text/javascript"></script>

Note: The Lymbix library requires the jQuery library, make sure to include it as well.

An instance of the Lymbix library can be initialized by passing an authentication key to its constructor.

var lymbix = new $.lymbix(YOUR_AUTH_KEY);
Methods

The Lymbix object exposes the following methods:

  • tonalizeMultiple(articles, callback, options)
  • Tonalize multiple articles
  • tonalizeDetailed(article, callback, options)
  • Tonalize an article
  • tonalize(article, callback, options)
  • Tonalize an article
  • flagResponse(phrase, apiMethod, apiVersion, callbackUrl, options)
  • Flag a response as inaccurate
Example Code
<html>
<head>
	<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="jquery.lymbix.js"></script>
	<script type="text/javascript">
		var lymbix = new $.lymbix(YOUR_AUTH_KEY);
		lymbix.tonalizeDetailed('I think you should get off your pedestal.', function (object) { alert(object.toSource()); });
	</script>
</head>
</html>
Example Output

	

Java

back to top
Installation

The Java wrapper can be downloaded from GitHub.

Configuration

Begin by adding a reference to the client library.

Import the Lymbix Client Library:

import com.lymbix.*;
import com.lymbix.models.*;

An instance of the Lymbix library can be initialized by passing an authentication key to its constructor.

LymbixClient lymbix = new LymbixClient(YOUR_AUTH_KEY);
Methods

The Lymbix object exposes the following methods:

  • ArticleInfo[] tonalizeMultiple(String[] articles, Map<String, String> options)
  • Tonalize multiple articles
  • ArticleInfo tonalizeDetailed(String article, Map<String, String> options)
  • Tonalize an article
  • ArticleInfo tonalize(String article, Map<String, String> options)
  • Tonalize an article
  • String FlagResponse(String phrase, String apiMethod, String apiVersion, String callbackUrl, Map<String, String> options)
  • Flag a response as inaccurate
Example Code
import com.lymbix.*;
import com.lymbix.models.*;

public class main {

	public static void main(String[] args) throws Exception {
		LymbixClient lymbix = new LymbixClient(YOUR_AUTH_KEY);
		System.out.print(lymbix.tonalizeDetailed("Jim is disgusted by the fly in his soup.", null).ArticleSentiment.SentimentType);
	}
}
Example Output
Negative