Chatbot using R

r
chatbot

#1

Hi Friends,
I was wondering if any one has worked or created chat-bot using R , as i have seen so many resources for chat-bot using Python AIML but haven’t come across any chat-bot created using R.
If anyone has done it please let me know or let me know any resource related to it.

Regards,
Hunaidkhan


#2

Hey @HUNAIDKHAN2000,

You can easily create a chatbot in any language that has certain library support. On a very high level, you need the following components for a chatbot -

  1. A platform where people can interact with your chatbot. Popular one nowadays is FB’s Messenger, Slack, etc.
  2. A server that continuously listens to your requests and responds appropriately. For this, you’d need libraries that help you send and receive HTTP requests over the internet.
  3. You’d need certain NLP libraries to help you preprocess incoming text into the form your ML model can understand.
  4. You’d also set up an ML model for any kinds of task you need.
  5. 3 and 4 will be initiated by your server based on the incoming query and the output of these will be picked up by the server and sent to the client(FB chat).

In short, any programming language that has these can be used to create a chatbot. On looking up for a chatbot using R, I found this link -

Hope this helps!
Sanad :slight_smile:


#3

I’ve used LUIS of MS Azure and wrote an R client for it. Maybe this can help you.


#4

Hi,
Can you please tell me how can get LUIS parameters?
Host link is giving me error:
{ “statusCode”: 404, “message”: “Resource not found” }

please let me know.


#5

You need to create a LUIS app first on https://www.luis.ai/home.
There you can retrieve the parameters like the key and app ID (I believe you mean this?).


#6

yes thank you
Can you please tell me How can I get parameters?
I not able to understand how to get Host, host, path, publishpath and questionpath
can you please tell me where is it?


#7

You’re welcome :slight_smile:


#8

But still I am confuse where can I get all parameters in LUIS account. I created App but now how to get all parameters still confusing


#9

In the Settings tab you can find the APP ID,
In the publish tab you can find the key (Key String).

Hope this helps :slight_smile:
CL


#10

Thank you sir for your kind reply.

I got AppID and Key. But I am not able to get publish path , questionpath and path how can I get this three parameters?


#11

You can check the structure of your path at the publish tab, under "endpoint’, maybe "V2.0’ is “V1.0” for you or equivalents.


#12

ok I will check and let you know.

Thank you so much for helping me


#14

@christiaanleysen

Hi thank you code is working but I am not able to understand how to add intent and utternace?
I tried to add .txt file as follows:
Hi|Hello
how are you|fine Thank you
are you looking for our web-scraping services? | yes
What you want to scrape? | I want to scrape restaurent data from cleartrip.com
Give us your contact details our customer representative will contact you soon| shethprem@gmail.com,9998085600

but it gives me error as below:

[1] "------ADDING INTENTS------"
[1] "c7719c08-dbd1-47e2-94f9-3b9c88d09fe9"
[1] "ed2e8b8a-e132-4b43-b913-3fa61e162592"
[1] "d586e95e-6dfd-4186-85ff-b8b4ac89d79e"
$error
$error$code
[1] "BadArgument"

$error$message
[1] "Model name should not contain more than 50 characters."


[1] "84d825d2-130e-41eb-a503-89951fb4983b"
[1] "------ADDING UTTERANCES------"
[[1]]
[[1]]$value
[[1]]$value$UtteranceText
[1] "hi"

[[1]]$value$ExampleId
[1] -69158


[[1]]$hasError
[1] FALSE


[[2]]
[[2]]$value
[[2]]$value$UtteranceText
[1] "hi"

[[2]]$value$ExampleId
[1] -69158


[[2]]$hasError
[1] FALSE


[[3]]
[[3]]$value
[[3]]$value$UtteranceText
[1] "how are you"

[[3]]$value$ExampleId
[1] -81349


[[3]]$hasError
[1] FALSE


[[4]]
[[4]]$value
[[4]]$value$UtteranceText
[1] "are you looking for our web-scraping services?"

[[4]]$value$ExampleId
[1] -13581043


[[4]]$hasError
[1] FALSE


[[5]]
[[5]]$value
NULL

[[5]]$hasError
[1] TRUE

[[5]]$error
[[5]]$error$code
[1] "FAILED"

[[5]]$error$message
[1] "What you want to scrape? . Error: Model name should not contain more than 50 characters."



[[6]]
[[6]]$value
[[6]]$value$UtteranceText
[1] "give us your contact details our customer representative will contact you soon"

[[6]]$value$ExampleId
[1] -13581044


[[6]]$hasError
[1] FALSE


[1] "------TRAINING MODEL------"
$statusId
[1] 9

$status
[1] "Queued"

[1] "------CHECKING TRAINING STATUS------"
[[1]]
[[1]]$modelId
[1] "c7719c08-dbd1-47e2-94f9-3b9c88d09fe9"

[[1]]$details
[[1]]$details$statusId
[1] 0

[[1]]$details$status
[1] "Success"

[[1]]$details$exampleCount
[1] 12

[[1]]$details$trainingDateTime
[1] "2018-02-15T05:27:31Z"



[[2]]
[[2]]$modelId
[1] "6d8e90c1-b93f-4af2-9bbd-3c2287205f60"

[[2]]$details
[[2]]$details$statusId
[1] 1

[[2]]$details$status
[1] "Fail"

[[2]]$details$exampleCount
[1] 12

[[2]]$details$failureReason
[1] "FewLabels"



[[3]]
[[3]]$modelId
[1] "ed2e8b8a-e132-4b43-b913-3fa61e162592"

[[3]]$details
[[3]]$details$statusId
[1] 0

[[3]]$details$status
[1] "Success"

[[3]]$details$exampleCount
[1] 12

[[3]]$details$trainingDateTime
[1] "2018-02-15T05:27:31Z"



[[4]]
[[4]]$modelId
[1] "84d825d2-130e-41eb-a503-89951fb4983b"

[[4]]$details
[[4]]$details$statusId
[1] 0

[[4]]$details$status
[1] "Success"

[[4]]$details$exampleCount
[1] 12

[[4]]$details$trainingDateTime
[1] "2018-02-15T05:27:31Z"



[[5]]
[[5]]$modelId
[1] "6a241db5-4a14-474d-86f5-97693f1ed6cb"

[[5]]$details
[[5]]$details$statusId
[1] 1

[[5]]$details$status
[1] "Fail"

[[5]]$details$exampleCount
[1] 12

[[5]]$details$failureReason
[1] "FewLabels"



[[6]]
[[6]]$modelId
[1] "4e77d5fa-35d3-495b-bebd-a5c6fd90c1b3"

[[6]]$details
[[6]]$details$statusId
[1] 0

[[6]]$details$status
[1] "Success"

[[6]]$details$exampleCount
[1] 12

[[6]]$details$trainingDateTime
[1] "2018-02-15T05:27:31Z"



[[7]]
[[7]]$modelId
[1] "d586e95e-6dfd-4186-85ff-b8b4ac89d79e"

[[7]]$details
[[7]]$details$statusId
[1] 0

[[7]]$details$status
[1] "Success"

[[7]]$details$exampleCount
[1] 12

[[7]]$details$trainingDateTime
[1] "2018-02-15T05:27:31Z"



[[8]]
[[8]]$modelId
[1] "9f4f751f-6beb-4836-9017-fe7f6b3f6768"

[[8]]$details
[[8]]$details$statusId
[1] 0

[[8]]$details$status
[1] "Success"

[[8]]$details$exampleCount
[1] 12

[[8]]$details$trainingDateTime
[1] "2018-02-15T05:27:31Z"



[1] "------PUBLISH APPLICATION FOR USAGE------"
$statusCode
[1] 404

$message
[1] "Resource not found"

Warning messages:
1: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  incomplete final line found by readTableHeader on 'c:/Users/admin/Desktop/Data Analytics/chatbot/train_data.txt'
2: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  incomplete final line found by readTableHeader on 'c:/Users/admin/Desktop/Data Analytics/chatbot/train_data.txt'

then when I run last line I got following error:
Error: lexical error: invalid char in json text.
Model not published. Please pub
(right here) ------^