Bot Driven Development
Mark Orel
About me
JS Addicted
@markbaraban
Software Engineer
Full-Stack Developer
Step back
Bot?!
< 90s
+- 00s
+- 05s
middle 20s
Dictionary.com
Nowadays
Beginning
- All in all, when will we create our own bot, to help people with booking?
- Think it's a great idea.
Motivation #1
Alcohol game:
1. Open any website.
2. If website has its own chat-bot -> drink.
Motivation #2
Proof of concept.
Language representation
- Are you sure?
- Yes/No.
Try #0
Try #1
Try #2
Flying Spaghetti Monster
Finite-state machine
FSM
M = (V, Q, q_0, F, \delta)
M=(V,Q,q0,F,δ)
V
V
Q
Q
q_0
q0
F
F
\delta
δ
is the input alphabet
is a finite, non-empty set of states
is an initial state
is the set of final states (possibly empty)
is the state-transition function
\delta
δ
action => handler(state, action) => state
set of states.
const Q = {
"0": hello,
"01": doYouLikeMe,
"010": sad,
"011": happy,
};
handle.
const doYouLikeMe = (state, params) => {
if (params) {
const goTo = makeStateDecision(state.id, params);
return {
id: goTo,
type: "transition"
...state
}
} else {
return {
message: "Do you like me?",
type: "input",
...state
}
}
}
make decision.
const makeStateDecision = (id, param) => {
if (param === 'YES') {
return '011';
}
return '010';
}
process.
let state = { id: 0 }
let params = null
while(true) {
const handler = Q[q.id]
state = handler(state, params)
if (state.type === 'message') {
say(state.message)
}
if (state.type === 'input') {
params = ask(params, state.message)
}
}
Done.
Upgrade #1
Global handler.
Upgrade #2
Machine learning
(HMM, Neural Networks)
Upgrade #3
AIasS
(wit, pandorabots)
Why should you try?
-
People are messengers-addicted
-
Expansion outlook
-
Maybe you'll become the creator of real AI
-
It's fun
Happy end.
@markbaraban
Homework
Bot Driven Development
By Mark Orel
Bot Driven Development
Talk about chat bots development approach.
- 1,990