Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

C++BuilderDelphiDemoFiremonkeyIOSLibraryOSXShowcaseWindows

Build Online And Offline Chat Bots With AIML For Firemonkey In Delphi 10 Berlin On Android And IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi Berlin Firemonkey AIML Chat Bot Android IOS | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSAll of the big tech companies like Google, Amazon, Apple, Facebook, and Microsoft seem to be building bots these days with Alexa (Amazon Echo), Cortana (Windows 10), Siri, Viv, Facebook Messenger bots, and Google Home. You can get in on the chat bot building frenzy with Firemonkey in Delphi Berlin using an upgraded version of PascAlice. Kim Sullivan created PascAlice as a free AIML interpreter for Delphi awhile ago. AIML stands for Artificial Intelligence Markup Language and it is an XML representation of a chat bot dialog tree. The AIML parser works offline so you can embed it on a device and it will work just fine without internet access. One reason for the rise of bots is the market saturation of apps in the various app stores. A recent VentureBeat article lists 10 ways bots are being integrated into business:

1. Improve customer service
2. Facilitate ecommerce
3. Provide better, more personal engagement
4. Enhance customers’ experience
5. Address customers’ needs in real-time
6. Integrate utility into the brand experience
7. Have conversation at scale
8. Talk openly and honestly, even about sensitive topics
9. Create opportunities for services integration
10. Improve customer loyalty programs

A number of AIML files like Knowledge.aiml have been embedded into the bot already from the AliceBot.org site to give it a little bit of brains (try asking it “how far is alpha centauri”). The parser takes in chat input and then runs it through the various AIML file it loads. I worked with a developer in Belarus via UpWork to upgrade PascAlice to that it supports Firemonkey in Delphi Berlin on Android, IOS, OSX, and Windows. We brought in the source code from this demo for the chat interface and upgraded it a bit with new virtual keyboard handling code. We replaced LibXmlParser with the cross platform OXml library. I wanted to implement some text to speech functionality so on Windows, IOS, and OSX it utilizes an unofficial Google Translate API but also supports a Voice RSS API for text to speech(TTS). The API based TTS works by just passing a translation URL to the TMediaPlayer component. On Android it utilizes the built in text to speech functionality using a component built by Delphi developers Jim McKeeth and Jeff Overcash.

Two other pieces of functionality that have been added to the bot are the ability to say “google delphi” or “google firemonkey” and it will open in an in app TWebBrowser. The bot for example could have functionality that opens the web browser based on various chat responses. The second piece of functionality that was added is a dynamic form response very similar to how the Facebook Messenger Bot works where it embeds a piece of content in the chat response. The dynamic form is built via JSON and you can test out the functionality by pressing the Inline Form button to see it in action. It will create a TFrame on the fly and then populate it with buttons from the JSON that is passed to it. In this case there are two lines with a Yes and No button. If the Yes button is pressed it will send a navigation to the TWebBrowser as well. The dynamic form functionality is pretty powerful and only a small amount of functionality is built into the demo. The dynamic from can also be saved and loaded from JSON using the Duck Duck Delphi library. Keep in mind this is a quick prototype with limited testing.

You can also connect the chat bot to a variety of REST APIs like Motion.ai, Api.AI, PandoraBots, or even Amazon Echo using TRESTClient if needed. Alternately, you can run your own AIML server with Program O for PHP. Or you could pull out the AIML parser and deploy it in your own Delphi server implementation. Who’s going to be the first developer to turn the Delphi documentation into a chat bot? Let us know in the comments how you use it!

Update: Fixed a small cross platform issue.

Download the PascAlice FMX AIML Parsing Chat Bot For Firemonkey In Delphi Berlin On Android, IOS, OSX, and Windows!

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts
DelphiDemoFiremonkeyLinuxOSXShowcaseWindows

AutoBlogAI: FireMonkey Client To Leverage LLMs And Generative AI For Blogging

DelphiFiremonkeyShowcaseUtilityWindows

Unleashing Creativity With Song Writer AI: A Deep Dive

DelphiFiremonkeyShowcaseWindows

How To Build Stable Diffusion Text To Image Prompts

AndroidC++BuilderDelphiFiremonkeyIOSOSXWindows

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

Sign up for our Newsletter and
stay informed

1 Comment

Leave a Reply