AI Zone Admin Forum Add your forum

CHATBOT MEETUP CHATBOT MEETUP CHATBOT MEETUP CHATBOT CHATBOT MEETUP CHATBOT MEETUP CHATBOT MEETUP CHATBOT MEETUP

On June 28th, 2017 we're organizing our next Chatbot Meetup in Amsterdam, The Netherlands. Feel free to join!'

Design and code for database chatbot
 
 

Hello everybody.
I’m making a chatbot based on Facebook’s Messenger platform. It’s written in Nodejs. After following the tutorial, I’ve built a basic chatbot that can work with if..else if statements. And to deloy it with Heroku. But my teacher, want me to put all user questions and answers into a file and upload that file to the server. .
I have created a txt file as attach but I do not know how to write code to analyze it. Long can anyone help me, thanks a lot !!!

File Attachments
keyword.txt  (File Size: 1KB - Downloads: 30)
 

 
  [ # 1 ]

Help me , please !

 

 
  [ # 2 ]

Load the text file,

How much tuition?
About $50
Around fifty dollars

How are you
?
I am fine,tks !

You are beautiful!
Thank you very much!
So are you

What day is today
?
Today,Monday 
Tomorrow Tuesday
I am not sure about today 

... into an array:

var script [
[
"HOW MUCH TUITION",
"About $50",
"Around fifty dollars",
],
[
"HOW ARE YOU",
"I am fine,tks !",
],
[
"YOU ARE BEAUTIFUL",
"Thank you very much!",
"So are you",
],
[
"WHAT DAY IS TODAY",
"Today,Monday ",
"Tomorrow Tuesday",
"I am not sure about today",
],
];

console.log(script[0][0]);  // How much tuition? 

The first element (uppercase) in the array is always key zero and always the “Q” which is matched.
And the remaining elements are 1,2,3, etc count can vary in the array and they are always the “R” list.
You can randomly pick one from the “R” list for a response.

Please note: This code is hand coded in a text editor and is not tested at all, and it is not complete, so it is just for discussion and learning purposes.  As a Node.JS programmer, you should be inspired from this pseudo code.

 

 

 

 

 
  login or register to react