Build Your First Watson Application in 4 Steps with this API


App General Assembly

For as long as I can remember, technology has had a major influence on my life. Growing up as a child, my parents recall stories of me sitting down at our large clunky PC with floppy disk storage and learning new words on Encyclopedia Encarta. I received my first laptop at in the 4th grade. Since then, my daily life has been “connected.”

My journey learning to code began with my first course on an online education platform. Starting with JavaScript, a scripting language for web-based programming, I traversed through the modules starting first with the basics of defining a variable (e.g. var x = “Hello World”), moving on to primitive data structures such as arrays (e.g. var y = [1,2,3]), and eventually Object Oriented Programming.

Shortly after, I enrolled in my first computer science course at Emory University as part of my mathematics curriculum. Although this course focused heavily on Java, a coding language full of new-to-me syntax and functions, the fundamentals of programming translated seamlessly and I quickly picked up the language. By understanding the fundamental basics of coding, I wielded the power to work to create a cognitive application.

The State of Cognitive Computing

The world is entering an API Economy. In this technological era of digital innovation, sophisticated services are exposed as a series of APIs for developers to easily harness and “co-create” new technologies. For example, one of Watson’s APIs is called Natural Language Classifier and interprets the intent behind text to return a corresponding classification and associated confidence level. This API could be helpful for companies looking to tackle common questions from users that are typically handled by a live agent. Developers can easily integrate this API, or any of the others, into their applications.

IBM realizes the profound impact of an API Economy and has exposed Watson’s cognitive capabilities as a suite of services on the Watson Developer Cloud hosted on IBM Bluemix. All developers can access IBM Bluemix to begin building with the APIs, along with resources to inspire creativity, including API starter guides and software development kits (SDKs) that guide you to the right services.

How to Build a Watson Application

Recently, I began reading the blog owned by a solution architect coworker, Ryan Anderson, whose hobby is hacking and innovating using the R programming language. In his blog, “Building Bridges from R to IBM Watson,” Ryan shares examples and open source code of small projects, highlighting the power of IBM Watson. I became fascinated at the ease at which Ryan could build a Watson application and integrate APIs such as Natural Language Classifier. I started studying his code and, examining it further, I found I could invoke a call to Watson with ONLY 3 lines of code in just 5 minutes time.

API Build A Watson Application

Inspired by this ease of use, I began developing a project to both augment and simplify information streams coming from Twitter. To create this information system I use these steps, which you can try out today:

  1. Create a corpus of tweets by mining Twitter data with the Twitter API and put those in a Comma Separated Value (“.csv”) file (Microsoft Excel can help with this).
  2. Manually classify the tweets as either an Opinion or News.
  3. Create an instance of Natural Language classifier (“NLC”) and create a classifier using the corpus we created. There is tooling on IBM Bluemix which can assist.
  4. Write a script that pulls tweets, runs them through Watson NLC, and depending on the outcome:
    1. Opinion – Gather the Tone, Sentiment, and Keywords from the tweet.
    2. News – Read the article and extract out Concepts, Entities, and Keywords to understand what the article is speaking to.

This type of application can help organizations understand the public’s opinion of their product. Positive opinions from users can provide instant feedback for Research and Development teams to innovate on new products while negative feedback needs to be mitigated quickly before escalating.

It’s especially useful for analyzing third party reviews (especially among competitors) and to determine common threads of things the business is doing well versus where it can improve, and then compiling that data down into understandable bite sized pieces. A great example would be to use these classifiers on comparison sites like this robo advisor comparison page, run the natural language processing API on each one to determine the sentiment and relevant keywords, and use the data extraction to figure out what themes are most often brought up amongst each offering to see how they approach the market.

Any developer can harness the power of Watson and innovate in today’s world with relatively little coding experience. My challenge to readers of this blog post: identify a project you are passionate about tackling, invest 1 hour per day to learning and writing code, and leverage the online resources at your disposal, including documentation and developer forums. Build a Watson application, combine cognitive APIs with other web services, and most of all – have fun!

For the curious, we present a collection of API mashup examples that provide creative solutions to your unstructured data problems.

Harness the power of Watson.

See more API mashups

Disclaimer: General Assembly referred to their Bootcamps and Short Courses as “Immersive” and “Part-time” courses respectfully and you may see that reference in posts prior to 2023.