Follow by Email

Search This Blog

Posts

Motivation"Artificial Intelligence (AI) is considered a major innovation that could disrupt many things. Some people even compare it to the Internet. A large investor firm predicted that some AI startups could become the next Apple, Google or Amazon within five years"
- Prof. John Vu, Carnegie Mellon University.

Using chatbots to support our daily tasks is super useful and interesting. In fact, "Jenkins CI, Jira Cloud, and Bitbucket" have been becoming must-have apps in Slack of my team these days.

There are some existing approaches for chatbots including pattern matching, algorithms, and neutral networks. RiveScript is a scripting language using "pattern matching" as a simple and powerful approach for building up a Chabot.
Architecture
Actually, it was flexible to choose a programming language for the used Rivescript interpreter like Java, Go, Javascript, Python, and Perl. I went with Java.

You can find the demonstrated code of this post on my Github repo here.
The user story" As a banker, I want to enter a client's birthday like 01.01.80 or 01.01.1980,So that the birthday can be displayed as 01.01.1980 "
Implementation
Firstly, I thought about how to use a built-in converter likes the following.

<h:inputText id="birthdate"
value="#{data.birthdate}"
type="date" >
<f:convertDateTime/>
<f:ajax event="change"
listener="#{data.onCalculate}"
execute="@this"
render="@this" />
</h:inputText>
However, without defining a pattern, JSF used its default one which was not my desire. It threw an exception when I tried to enter a date like "01.01.90".

> myform:birthdate: '01.01.90' could not be understood as a date. Example: Mar 4, 2018

Actually, I even could not define either pattern "dd.MM.yyyy" or "dd.MM.yy" for &quot…