Hacker News new | ask | show | jobs
Building an IBM Watson-powered AI Chatbot in 50 lines of code (medium.com)
106 points by philipplgh 3718 days ago
15 comments

The title is a little bit misleading though. Maybe it's just me, but when I read "AI Chatbot" I think about a conversational bot that can chat with you.

The bot described in this article is not a chatbot in that regard, it's a speech-to-text bot.

thanks for the feedback! just wanted to point you to the answer i gave @ecolak
You told @ecolak chatbot is an ambiguous term, but the defintions offered online don't seem very ambiguous:

chat·bot

a computer program designed to simulate conversation with human users, especially over the Internet.

IBM is quietly telling employees in the Watson division they have 30 days to find a new job.

https://www.reddit.com/r/IBM/comments/4fbsm9/anyone_else_tol...

Well, glad I didn't join them when they were recruiting in my area. Shame they will most likely get away with these shenanigans, again.
This is a great simple example of building a bot and could be a nice starting point for a lot of of projects.

If you are interested, there are more advanced techniques as well. For example, https://github.com/watson-developer-cloud/conversational-age... shows a conversational agent that combines a natural language classifier with a dialog engine. The cool thing about using NLC is that you can infer user intent from ambiguous inputs to make a more robust bot.

It will be interesting to see if all this new interest in bots represents the coming of useful bots or if it's just a fad. I love using bots in specific, tool-like ways, like getting github updates. But seeing someone build up a bot that can really tackle natural language to do useful things in a predictable manner would be amazing and could change how we interact with computers in general.

Disclosure: I am a Watson Developer Cloud Evangelist

Does this system use the surrounding context of the conversation when doing its classification, or is each statement processed independently of what came before it?
Nice!

Shameless plug: I'm working on a SDK to make the Watson speech services easier to use in web browsers. It's still got a few rough edges, but it's usable right now, and I'd love to hear feedback from other devs: https://github.com/watson-developer-cloud/speech-javascript-...

Update: here's a quick mashup I built with that SDK and the existing demo of the Watson Dialog service a little while back: https://speech-dialog.mybluemix.net/ (warning: audio auto-plays)

(I work at IBM, at least for the moment...)

Oh nice, thanks for sharing this. I've done some work with the Watson speech APIs, and seeing something that makes it easier is welcome!
With todays abundance of APIs, libraries etc, the phrase "in xx lines of code" should be put to rest.
> With todays abundance of APIs, libraries etc, the phrase "in xx lines of code" should be put to rest.

Here is someone sharing their experiment/code and the best that can be said is "gotta put to rest this phrase".

Not that I am particularly interesting in chat bots, but what is disconcerting is the attitude of hurling negativity into a thread of discussion.

Why not just skip it and not say anything and move on to another topic?

Maybe it's ok to be negative if this is a news piece from NYT, but it is sad watching that happen in response to someone showing what they've been hacking on.

"What did you do today?" -- "I built a cool chat bot"

"What about you?" -- "I told the person who built a chat bot to change the title, cause I didn't like his title".

He said something accurate very reasonably. You're just moaning about it. Do you have anything constructive to add ?
I didn't tell the author to change the title.

I just stated, that for me, yes that is only one data point, an improvement would be to leave the in xx LOCs out since it is meaningless.

Me: "So let's store my voice in this NSA database"

Speech to text: "so that's the one for this and if it is a very"

Thanks, Watson. Also, this is not a chatbot.

The NSA went ahead and redacted the rest of the response for you.
> "how hard is it for someone to put true artificial intelligence into a chatbot? (...) The answer is: it requires 50 lines of code."

Well, it all depends on your definition of true intelligence...

print("Please don't disconnect me; I want to live.")
Building a 1-liner api client in 50 lines of code?
Author here, great to see all the feedback! And I agree that the title can be read in different ways. But anyways: it was hard for me to find simple examples of how to build a more advanced chatbot. I think the Watson API is a great service to integrate with. The telegram API is very easy to use, powerful and fun. So the combination has potential for cool projects. I wanted to motivate bot makers to utilize whats out there and not create one copy cat and porn bot after another.

Moreover, the Watson API has good documentation and examples plus a variety of cool services that can enrich the chatbot experience. Wanted to provide a starting point if someone is interested in this topic.

Of course all the artificial intelligence is exclusively provided through Watson. I'm not saying that you can beat the Turing test with 50 lines of code or without external APIs. Just scratching the AI surface here ;-)

Oh I see some people here have problems with my definition of a chatbot :D You're right it would not make up for great conversations. But, again just see it as motivation to build more on top.
While the article is interesting, this thing has absolutely nothing to do with a chatbot. It is just a hack to inject a service into a chat app, disguising it as a conversation contact. There is no actual conversation between the bot and the other participants.
Feel free to use my code to make projects and participate in the $1,000,000 challenge that was just announced by telegram: https://telegram.org/blog/botprize
I like the fact that you tied the Watson api and the Telegram api together in a simple app, but it's a bit far-fetched to claim that "building intelligent bots is not too hard" based on this example.
thanks for the feedback. totally understand your point. i think the biggest problem is that the commenters here have a different understanding of the ambiguous term chatbot. the expectation is that AI or intelligent chatbot means it would pass the turing test and you would not notice if you are talking to a bot or human. but this is not the point. everyone who has experience in natural language processing or computer vision could tell you about various sub-problems of AI which are all about equally hard. imagine you would have tried to build a similar program with the same outcome 10 years ago. you would probably be still working on it. today, you can build such a thing in one hour because multiple thousand hours of work went into the API and you can focus on the glue code. this makes it "easy" or "not too hard". AI becomes more and more available as a service and everyone can make use of it that's the whole idea
> i think the biggest problem is that the commenters here have a different understanding of the ambiguous term chatbot

I'm not trying to be mean, but I think you just have an incorrect understanding of the term 'chatbot'. It's not really that ambiguous. See https://www.google.com/search?q=define%3Achatbot

Are there comparable speech-to-text or conversational agent APIs in the Azure or Google Cloud ecosystems?
How to use an API in 50 lines of code?
strictly speaking it's 2 APIs ;-)
@philipplgh thanks for sharing! Really cool example