web development

Measuring My Blog’s Emotional Tone with IBM Watson

[Original post, from 2015-12-09:]

I developed a WordPress plugin that shows the emotional tone of blog posts using the “experimental” IBM Watson Tone Analyzer API.

My plugin extracts the contents of a blog post and sends it to the IBM Watson Tone Analyzer API, which returns scores for several attributes, including the three attributes of emotional tone that IBM has found to be most salient, viz. cheerfulness, negativity and anger.

According to IBM:

  • Cheerfulness refers to positive emotions such as joy, optimism, contentment, inspiration, and happiness.
  • Negative emotions include feelings of fear, disgust, despair, guilt, rejection, and humiliation.
  • Anger is a type of negative feeling with strong intensity such as annoyance, hostility, aggression, hurt, frustration and rage.

Finally, the plugin pulls these scores from the API response body and displays a simple bar graph.

The cognitive science behind their analysis is a bit beyond me.  It appears to look for emotitone of post bar chart (using IBM Watson)onally loaded words. For example, if you put the word “lousy” in your post, it will bump the negativity and anger scores way up… (Note how the word “lousy” in this post results in high “negativity” and “anger” scores in the bar chart. )

This product has interesting implications. I’m guessing someone in advertising somewhere is doing A/B testing on copy to see if more “cheerful” ads sell more widgets….

For Further Reading

Rama Akkiraju, IBM Watson Tone Analyzer – new service now available,
https://developer.ibm.com/watson/blog/2015/07/16/ibm-watson-tone-analyzer-service-experimental-release-announcement/ (July 16, 2015).


Update: The State of My Emotional-Tone-Measuring WordPress Plug-In

[Update of 2016-02-26:]

IBM updated the API used by my plugin in February, which broke my implementation of it.

(Such is the nature of using random, free, experimental APIs….)

From “Experimental” to “Beta”

Their Tone Analyzer API has been promoted from “Experimental” status to “Beta”.  The new version adds some significant enhancements.

This WP plugin project was a proof-of-concept done for giggles. No client; no budget.

I consider the concept to be proven and have moved on to the next adventure.

 

coding, web development

Hello, World!

Is there a better first statement than “Hello, World!”?

It carries the same powerful message as “Greetings, Planet! I’m here. Deal with it!” in a compact, pithy package.

Many programming students wrote “Hello World” as their first output.  (The original such use is widely attributed to Brian Kernighan of Bell Labs.)

Ways to Say It

The syntax required to produce “Hello World!” gives you a flavor of the language.

In Java one would type the following:

class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

In JavaScript, one would code the following:

document.write('Hello, World!');

A PHP programmer’s first line is typically something like this:

echo "Hello, world!";

This syntax hints that it’s a lot easier to get up and running in JavaScript or PHP than in Java (The further implications of that suggest a subject for another day).

It’s fairly easy to get started with WordPress — the platform does the actual coding for you.

Ways to Say It, Part 2

But what is in between the quotes?  Doesn’t that say something about the programmer’s (human) language?

Shouldn’t there be a comma in “Hello World”?  In English, commas are used to set off words of direct address, and you’re directly addressing the World.  Speaking of which, “World” should be capitalized – you’re not addressing any world, you’re addressing THE World — by name!  And an exclamation point, for that matter — First impressions count – don’t you want to be seen as enthusiastic about your very first output!

So, “Hello to you, World — hello!”

Sources

http://en.wikipedia.org/wiki/Hello_world_program
http://www.helloworldexample.net/
http://docs.oracle.com/javase/tutorial/getStarted/application/index.html
http://www4.ncsu.edu/~wdlloyd/grammarreview-commas.htm
http://stackoverflow.com/questions/602237/where-does-hello-world-come-from