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.
The .NET wrapper can be downloaded from GitHub.
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);
The ToneAPI object exposes the following methods:
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();
}
}
}
Negative
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.
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
The Lymbix object exposes the following methods:
require 'lymbix'
lymbix = Lymbix::Base.new(YOUR_AUTH_KEY)
p lymbix.tonalize("I like ruby.")
=> {"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}
The Javascript wrapper can be downloaded from GitHub.
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);
The Lymbix object exposes the following methods:
<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>
The Python wrapper can be downloaded from GitHub.
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)
The Lymbix object exposes the following methods:
from lymbix import Lymbix
lymbix = Lymbix('dfcad1488854c47dd26f30d3eb424c77e5606801')
print lymbix.tonalize_detailed("I can't stand all this snow anymore.")
{'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'}
The Java wrapper can be downloaded from GitHub.
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);
The Lymbix object exposes the following methods:
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);
}
}
Negative
The PHP wrapper can be downloaded from GitHub.
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);
The Lymbix object exposes the following methods:
<?php
require_once 'Lymbix.php';
$lymbix = new Lymbix(YOUR_AUTH_KEY);
print_r($lymbix->TonalizeDetailed("I'm walking on sunshine... ooooooh, oh!"));
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 ) ) )