How Watson and Bluemix See the State of the Union

Posted by Jeff Sloyer on Wed, Jan 21, 2015
In Sample Code, Tutorial,
Tags watson bluemix node.js

The State of the Union, a live broadcast that many Americans historically use as a tool to form opinions about the current political system, and gain insight from their Commander in Chief into the transparency of a system of checks and balances.  What is more interesting is the thoughts and underlying feelings between the State of the Union.  If we could figure out how the President is feeling or portraying himself, could we infer how the President will schedule and work with legislation and policy for the rest of the year?

 How Watson and Bluemix see the State of the Union

If we tried to do this today, could we go back and re-read all of the State of the Unions and apply custom algorithms to help determine the sentiment behind the speeches?  This is no longer a dream, but a reality.  We can use IBM Bluemix to create an app that will pull in the speeches and leverage the IBM Watson User Modeling Service to analyze the speeches.

Wouldn’t it be interesting if we could compare the speeches from previous State of the Union addresses and compare the underlying sentiment behind them?  Today we can, and it is pretty easy.  MSNBC published How a supercomputer sees the State of the Union explaining how they used IBM Watson to do this.  Let’s take it a step further, let’s build our app in about 5 minutes, and try it ourselves!

So let’s dig into how we could do this.

BluemixSOTU3 How Watson and Bluemix see the State of the Union

Let’s Build it!

The goal at the end of these couple steps is to have our own Node.js app that uses the User Modeling Service to analyze the 2015 State of the Union.

  1. So first we need to sign up for Bluemix if you don’t have an account.

  2. Once we have logged in visit the Catalog and at the top under Boilerplates let’s click on UserModeling Node.js, or go directly here.

  3. On the right hand side we just need to give our app a name.  This will be the URL we will access our app at.  Note, it needs to be unique, for my app I chose sotu-jbs, you can choose anything you want.watsonappcreate How Watson and Bluemix see the State of the Union

  4. Click Create.  What is happening behind the scenes is Bluemix is spinning up a Node.js starter app that will allow you to analyze the state of the union address with Watson.  Pretty cool huh?

  5. Bluemix will take you to a dashboard and after a little bit it will show you that your app is up and running.  To access our app, click the URL near the top of the dashboard under the name of our app.apprunning1 How Watson and Bluemix see the State of the Unionurlforapp How Watson and Bluemix see the State of the Union

  6. Now the hard bit, we need to grab the full text of the speech.  This year was the first time the White House put out the full text of the speech, it is available on CNN.  I have also made the full text available here.  Copy this text.

  7. Go back to your app you created that just opened up.  It should show something like the following.  We want to clear the text and paste the full contents of the State of the Union.usermodelingapp How Watson and Bluemix see the State of the Union

  8. Click “Analyze”.

That’s it.   You should have some output like the following. With Bluemix and Watson we were just able to analyze the sentiment/personality of the President in the 2015 State of the Union.

Personality with percentages:

personalitysotu 461x1024 How Watson and Bluemix see the State of the Union

Personality Visualization:

visualizationsotu How Watson and Bluemix see the State of the Union

Wrap up

So let’s go over what we did, in a matter of less than 5 minutes we spun up a Node.js app, connected it to Watson and analyzed the State of the Union.  What Bluemix does for us is gives us a platform to run our apps and connects super cool and powerful services such as Watson to our apps in a matter of seconds.  In the image below, we can see our app running and that is connected to Watson.

watsonconnected How Watson and Bluemix see the State of the Union

If you want to give this a try without deploying an app head over to the User Modeling Demo in Bluemix and paste in your text.

Learn More

If you want to learn more about other Bluemix services and Watson services go to the following links.

comments powered by Disqus