📜 ⬆️ ⬇️

What I learned by writing a chat bot in 2 hours

A new paradigm is on the threshold - or not?




According to a study by Flurry , a resident of the United States, on average, spends about five hours a day on a smartphone. This figure is surprising in itself, but, in addition, about 65% of this time is spent on all sorts of communication - social networks, text messages, email and phone calls. That is, 3 hours and 15 minutes - every day.

And this means that everything has changed very, very much. Wanted to make a mobile app for your cool project? He will have to compete with millions of other applications for the remaining 35% of the time daily users of the smartphone. And do not forget the attendant costs of finding a worthwhile idea.
')
If you do not make an application, what are the options? You need to somehow build a business, right? Most experts believe that the next step in technology development is chat bots living in applications: they expand the functionality of larger platforms, such as Facebook or Telegram, and the user does not need to install another application on the phone. It turns out mutual benefit - except for the developer, probably. My doubts about the newfangled technology could be summarized in two points:


To understand this question, I had to study something. About a month I just read the literature on the topic, talked with experts, played with the tools and did not dare to get down to business - but in the end I wrote a working bot in about 2 hours. All this was in order to understand whether my doubts were groundless — well, for pleasure, of course.

Transferred to Alconost

The beginning of the way



Photo - Casey Fyfe , Unsplash playground

It is believed that inspiration often comes unexpectedly, so you need to look at both, so as not to blink it.

I started writing this article without knowing anything about bots. I had a rather superficial idea of ​​how controlled learning works at all and what AI is - for me the combination of NLP was just an abbreviation of natural language processing. My desire to deal with chat bots is about half due to the fact that I wanted to fill in the gaps in this particular area. On this occasion, there is a good quote:

"Getting rid of one's own ignorance is one of those joys of life that are available only to the most restless minds."

First of all, I aimed at the first assumption that bots do not have commercial benefits. After a bit of searching, I stumbled upon the Botlist , where an unimaginable number of bots were collected. Looking through the list, I tried to guess why the developer chose the bot, rather than the application, to solve the problem, and to give such a choice a reasonable explanation. I wanted to understand how a bot can be attractive in terms of business.

Of course, I came across a bot Mitsuku (Mitsuku) - it was interesting to chat with him. Quite an interesting problem solved Dr AI. The Rightclick.io helper is not bad, but, for my taste, slightly unhurried. After reviewing a lot of bots, among which were simple bots for word games, and, for example, TVakis , I came to the conclusion that their approach is quite utilitarian. It seemed that they were at an early stage of development. At the same time, seeing what tasks are being solved by chat bots, I had enough ideas to make my own chat bot.

I have to admit, at some point I felt like a student at an art school, wandering around the Louvre, looking for inspiration. But one question still gave me no peace.

Where is the breakthrough application?



Photo - Jeremy Bishop , Unsplash Playground

The botanical industry is just beginning to develop; Everyone tries to get around the rest and succeed in one thing - to find a breakthrough application that will bring chat bots to the masses. However, the winner has not yet been seen, and the game continues on this huge field.

To find out how much more to wait, I talked to a lot of people - and this, of course, was very informative. Experts with whom I spoke, agree that the appearance of a truly breakthrough chat bot to wait another two years, or even all five. Technology is evolving, and it's safe to say that even the best chat bots for today may be outdated in the light of new advances in the fields of artificial intelligence and NLP.

In other words, if the “right” idea suddenly appears, then anyone can make a potentially breakthrough application - and this discovery has greatly spurred my excitement. Chat bots with which I have been playing solve fairly simple tasks and, in essence, are simply a replacement for the graphical interface. Good bots, I noticed, among other things, two features:


Actually, it doesn't matter if you are writing a graphical interface or a chat bot - the user will choose your solution only if it saves time.

Choosing a chat bot instead of an application can really benefit a business: a bot saves time in longer-than-expected chains of actions in the interface. My next goal was to write my own bot to understand how difficult it is.

We are going to bot



Photos - Namroud Gorguis , Unsplash playground

For me, creating a chat bot was something like a sane-sized mosaic assembly: you just had to find the right pieces and the right tools. A piece of the mosaic was literally at hand, but I still did not know where to start. I had two requirements:


I wanted to get a confident answer to the question of whether it is difficult to write a chat bot, taking into account the restrictions. Since I am quite new to natural language processing, the learning curve for most of you is likely to be the same as mine.

Having twisted a few possible tasks in my head, I finally decided to make a chat bot that receives the lines written in natural language and correctly calculates the requested date. For example, at the entrance we submit something like this: “What will happen in 6 days from now?”, “5 weeks from next September” - and at the output we get the desired date.

Such could be a simple architecture of such a bot:



Following the recommendations of this guide , I used the basic methods of NLP, a neural network based on a multi-variable logistic function (softmax) and made a classifier of intentions, which took less than two hours (the installation of Tensorflow on a Windows computer also came at that time). After the intention is determined, the string is analyzed for the input data, and the output is the date I need. For me, it would be better if the entered date were to parse and transmit the NLP module, but in this form the bot confirms its operability.


Enter in a natural language.


The result of the work. Do not really mess with such a chat bot.

Frankly, it was not so difficult. Skillfully using the Messenger platform from Facebook and the Telegram bot platform, as well as the capabilities of the api.ai , wit.ai and recast.ai services , it would be possible to write a bot faster than I could.

It has its own learning curve, and this is understandable: where is it not?

Step by step, learn a new sphere for yourself, and then implement the working idea - a refreshing occupation, and a pleasant one too.

Salt, pepper - done!


Having written a chat bot for personal use, I discovered the world full of various possibilities. A huge number of tasks are solved by means of an interface consisting of many elements: booking flights, hotels, movie tickets, ordering food, etc. By replacing such an interface with a chat bot, you can make life easier for users. Frankly, the novelty of this approach excites the mind. There comes a time when a new Facebook or WhatsApp should appear on the scene.

It seems to me that the outlines of the world are already emerging, in which, having chatted with a bot, you can do anything - like in the movie “ She ” - even more efficiently than with one touch of the smartphone screen. But I would not advise falling in love with such Samantha. ;)


Photo - She (2013), Annapurna Pictures

But seriously, chat bots are definitely a promising trend. Everyone is arguing over how long it will last, but trends do not in themselves live and die - their fate depends on people.

I believe that the hype around something allows you to bring this something out of obscurity. The IT industry is just exploring what can be done with this relatively new technology. So if you are an entrepreneur - a game worth the candle. And if the developer - be sure to learn this technology.

In the end, the best bots have yet to write.


About the translator

The article is translated in Alconost.

Alconost is engaged in the localization of games , applications and sites in 68 languages. Language translators, linguistic testing, cloud platform with API, continuous localization, 24/7 project managers, any formats of string resources.

We also make advertising and training videos - for websites selling, image, advertising, training, teasers, expliners, trailers for Google Play and the App Store.

Read more: https://alconost.com

Source: https://habr.com/ru/post/339374/


All Articles