Making Chatbots from English Dialog

Now we advance the art of programming to the next level.

Here’s how that goes.

Instead of writing actual programs, we just write English dialogs— plus a miniscule “programming” part that consists solely of looking up the names of some JavaX standard functions.

A Date Bot

Let’s assume we want a bot that tells us the date in some fancy format.

The only programming part consists of calling the JavaX functions year(), month() and dayOfMonth() which give us the date in some numerical form. The dialog engine will then automatically convert all these numbers into the text we want.

So here’s the complete “program”: (Hard to call it that, even!)

Usr: What's the date, bot?
[year()=2917]
[month()=11]
[dayOfMonth()=5]
Bot: Yo, it's the 5th of November, 2917, master!

Quite obviously, the 3 lines in the middle are the calls to JavaX functions, the rest is plain English. The numbers you see are just some random (roughly plausible) examples; we could have used anything there.

And that’s it; that’s all we have to do.

Doubling The Input Provides A Lot Of Safety

Well, OK, there is one more thing. We might want to provide one more dialog just like that, but with different numbers. That way we make sure the engine catches the idea we are conveying. (The dialog engine can verify itself through redundant input.)

Usr: What's the date, bot?
[year()=2317]
[month()=1]
[dayOfMonth()=2]
Bot: Yo, it's the 2nd of January, 2317, master!

And then it’s done.

And now you tell me throwing together 5 (or 10) lines of dialog ain’t a hell of a lot simpler than writing a complete chat bot in Java, JavaScript, C# or whatever you’d use!

Screenshot of the complete bot:

Program that runs on Windows, Linux, Mac OS.

Send me your example dialog to get a free bot!

BTW: This will work in any human language; I used English as an example.