Jump to content

Can you help me make my chatbot virtually learn from input


Recommended Posts

Please help me. I don't need the code spoon fed to me, but can you please lead me in the right direction.

I am trying to write into the code of my chatbot a way that when I say something to it, and it eventually says

that same thing back to me, that the next response I give it, it adds to the collection under what was said

that made it say that thing it said. So if I type hello to it, it creates a file called hello.txt and hello1.txt and when

I say hi back to it after says hello, it will have hi stored in the hello.txt folder, after previously pulling hello from

hello1.txt and which it says to me, so everytime I say anything it gets added, so it can always pull something to

say. the questions are gonna be harder, so I need a way to drop the ? from $text everytime a question is asked,

because it is impossible to create a text file called how are you doing?.text I came up with a way to make it create

the files but I haven't figured out how to link them together, so it knows to pull the text from what you type.txt 

after reading it from what you type1.txt So I say i went to the mall today, and when it says it back to me I say

whatever I say, did you buy anything you like?, and the next time I say i went to the mall, it says did you buy anything

you like. And I want it to keep adding to the collections of every thing it says, every time it says different things back

to me. Thanks. Please help. Here is my code.

 

 

Snoop Dogg Webcam Catterbot.au3

Link to comment
Share on other sites

870 kB.  I would not call it a snippet of your code.  Please provide a strict minimal runable script that shows the issue you are facing.

Please use tags when you post code as described in the link...

Link to comment
Share on other sites

#include <File.au3>
#include <MsgBoxConstants.au3>

call("main")
func main()
$text = inputbox("Chatting With Snoop Dogg ", "Snoop Dogg: ")






if @error = 1 Then
    Exit
endif
$copy = ".txt"
$file = $text & $copy

filewriteLine($file, "") ;no text



$copy = "1.txt"
$fileand = $text & $copy :rights file just fine

filewriteLine($fileand, $text) ;writes file just fine

;I am looking for a way for the script to know the difference between what is typed.txt and what
;is typed.txt and be able to reply with what is in the txt file, I want it to virtually learn,
;and if I say i like pizza, and when it eventually says it back to me, the next time I say so do
;I, so the next time I say I like pizza it says so do i, and whenever I respond to it again after it
;says I like pizza, I want it to give the same responces that I am giving about pizza, back to me
;everytime I say that, and i want it to be able to do it with everything I say. But I don't know
;how to program it, thats all. I just need to be lead in the right direction.


if StringInStr ($text, "Snoop Dogg") then
shellexecute("c:/windows/chatterbots/Snoop Dogg.mp4")
Sleep(Random(6131,6132, 1))
MsgBox(4096, "Snoop Dogg", "That is my name, don't where it out.")
else
MsgBox(4096, "Snoop Dogg", "Why didn't you call me Snoop Dogg.")
call("main")
endif

 

Link to comment
Share on other sites

Quote

 

#include <File.au3>
#include <MsgBoxConstants.au3>

call("main")
func main()
$text = inputbox("Chatting With Snoop Dogg ", "Snoop Dogg: ")






if @error = 1 Then
    Exit
endif
$copy = ".txt"
$file = $text & $copy

filewriteLine($file, "") ;no text



$copy = "1.txt"
$fileand = $text & $copy :rights file just fine

filewriteLine($fileand, $text) ;writes file just fine

;I am looking for a way for the script to know the difference between what is typed.txt and what
;is typed1.txt and be able to reply with what is in the txt file, I want it to virtually learn,
;and if I say i like pizza, and when it eventually says it back to me, the next time I say so do
;I, so the next time I say I like pizza it says so do i, and whenever I respond to it again after it
;says I like pizza, I want it to give the same responces that I am giving about pizza, back to me
;everytime I say that, and i want it to be able to do it with everything I say. But I don't know
;how to program it, thats all. I just need to be lead in the right direction.


if StringInStr ($text, "Snoop Dogg") then
shellexecute("c:/windows/chatterbots/Snoop Dogg.mp4")
Sleep(Random(6131,6132, 1))
MsgBox(4096, "Snoop Dogg", "That is my name, don't where it out.")
else
MsgBox(4096, "Snoop Dogg", "Why didn't you call me Snoop Dogg.")
call("main")
endif

 

Link to comment
Share on other sites

  • Moderators

rogerdodger,

Welcome to the AutoIt forums.

Quote

Can someone help me please?

I very much doubt it. You have posted 49000 lines of completely uncommented code and your attempt of explaining what it is you are trying to achieve in the OP is as clear as mud. I suggest you try and formulate what you want to do in a more intelligible form - then we might be able to offer you some advice on how to proceed.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

9 hours ago, Melba23 said:

rogerdodger,

Welcome to the AutoIt forums.

I very much doubt it. You have posted 49000 lines of completely uncommented code and your attempt of explaining what it is you are trying to achieve in the OP is as clear as mud. I suggest you try and formulate what you want to do in a more intelligible form - then we might be able to offer you some advice on how to proceed.

M23

ago
Quote

 

#include <File.au3>
#include <MsgBoxConstants.au3>

call("main")
func main()
$text = inputbox("Chatting With Snoop Dogg ", "Snoop Dogg: ")






if @error = 1 Then
    Exit
endif
$copy = ".txt"
$file = $text & $copy

filewriteLine($file, "") ;no text



$copy = "1.txt"
$fileand = $text & $copy :rights file just fine

filewriteLine($fileand, $text) ;writes file just fine

;I am looking for a way for the script to know the difference between what is typed.txt and what
;is typed1.txt and be able to reply with what is in the txt file, I want it to virtually learn,
;and if I say i like pizza, and when it eventually says it back to me, the next time I say so do
;I, so the next time I say I like pizza it says so do i, and whenever I respond to it again after it
;says I like pizza, I want it to give the same responces that I am giving about pizza, back to me
;everytime I say that, and i want it to be able to do it with everything I say. But I don't know
;how to program it, thats all. I just need to be lead in the right direction.


if StringInStr ($text, "Snoop Dogg") then
shellexecute("c:/windows/chatterbots/Snoop Dogg.mp4")
Sleep(Random(6131,6132, 1))
MsgBox(4096, "Snoop Dogg", "That is my name, don't where it out.")
else
MsgBox(4096, "Snoop Dogg", "Why didn't you call me Snoop Dogg.")
call("main")
endif
Link to comment
Share on other sites

I think the simplest way to do this is to  randomly send the text in the txt file of what you type1.txt to the message box during the conversation, and then have the what you type.txt save the statement/answer to the statement/question, and then when the randomness picks up on what is typed for the answer program it to say the same statement/answer that you gave for the last question, with multiple answers/statements that it can give, once you have it programed in. So it is virtually learning from what you say, and is always in learning mode. Can you help?

Link to comment
Share on other sites

  • Moderators

rogerdodger,

Posting several "stream-of-consciousness" lines basically saying the same thing does not help us understand - neither does repeating them as comments within a short script.

So one last attempt: I suggest you write a series of short points describing what you want to happen in order - something like this based on what I think you are asking:

  • User types in a comment
  • Script checks if question has been asked before
  • If it has, then picks a random reply from its previous replies
  • If not, then picks a random reply from all possibilities

Now, there are obviously more steps that that, but I hope you get the idea. And once you have the steps in order it will help you write the code in a sensible manner. Over to you.

M23

P.S. When you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation.

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hello,
From what I understand, a solution can be:

* Use ControlGet functions.

    * Get the handle of the edit control, that is, the input field.
    * then get the text or the last line of the edit control. This can be done with a loop, but you could keep in mind that:
    * you have to control the way the chat is registered, that is:
    * if there is new text, do something. Otherwise, it waits until new text is found.
* the rest is up to your creativity.

Link to comment
Share on other sites

Spoiler

i need whatever is typed into the input box, to be asked back to me, which I can do. But when that thing is asked I need the next thing typed in to be set a long with other lines that are asked when that same thing is said or asked, and pull one of those things up randomly every time I respond to the chatbot with that same saying/statement that was asked.

 

Link to comment
Share on other sites

1 hour ago, Mateocedillo said:

 

i need whatever is typed into the input box, to be asked back to me, which I can do. But when that thing is asked I need the next thing typed in to be set a long with other lines that are asked when that same thing is said or asked, and pull one of those things up randomly every time I respond to the chatbot with that same saying/statement that was asked.

 

Hello,
From what I understand, a solution can be:

* Use ControlGet functions.

    * Get the handle of the edit control, that is, the input field.
    * then get the text or the last line of the edit control. This can be done with a loop, but you could keep in mind that:
    * you have to control the way the chat is registered, that is:
    * if there is new text, do something. Otherwise, it waits until new text is found.
* the rest is up to your creativity.

 

 

i need whatever is typed into the input box, to be asked back to me, which I can do. But when that thing is asked I need the next thing typed in to be set a long with other lines that are asked when that same thing is said or asked, and pull one of those things up randomly every time I respond to the chatbot with that same saying/statement that was asked.

Link to comment
Share on other sites

37 minutes ago, rogerdodger said:

 

 

i need whatever is typed into the input box, to be asked back to me, which I can do. But when that thing is asked I need the next thing typed in to be set a long with other lines that are asked when that same thing is said or asked, and pull one of those things up randomly every time I respond to the chatbot with that same saying/statement that was asked.

Ah, I think I understand and I hope you do too. What @rogerdodger wants to do is a chat robot, an example is Elisa or Dr. Abuse, which are robots where you can write any text and the robot responds according to the text you write. And yes, a training process can be done for this, and I see that in your code there are lines with questions and answers from the bot, all with loose conditionals, and this code can be saved with arrays and so on. I have an idea of this, so I could help you, but I would need you to confirm if that is what you are looking for.

Link to comment
Share on other sites

I already have the chat bot created, but yes that is exactly what I am trying to do, is add that to it. I want it to work like it does now, and talk like it does now on the first response, just like it does, I want the 2nd response to be where it answers back to me with the same response that I gave it for the same question or statement that I said in the past. I want this part to take the place of brain.txt the brain.txt is at the very bottom of the 49000 lines of code, but if that statement/question isn't said to me, I want it to use brain.txt to respond back to me on the second response. If you could help that would be awesome.

Link to comment
Share on other sites

1 hour ago, rogerdodger said:

I already have the chat bot created, but yes that is exactly what I am trying to do, is add that to it. I want it to work like it does now, and talk like it does now on the first response, just like it does, I want the 2nd response to be where it answers back to me with the same response that I gave it for the same question or statement that I said in the past. I want this part to take the place of brain.txt the brain.txt is at the very bottom of the 49000 lines of code, but if that statement/question isn't said to me, I want it to use brain.txt to respond back to me on the second response. If you could help that would be awesome.

Let's see...
First of all, reduce code instead of calling many functions, when in reality these functions can only be linked to one. This also prevents spam, for example this part is repeated the most:
shellexecute("c:/windows/chatterbots/Snoop Dogg.mp4")
Sleep(Random(6131,6132, 1))
MsgBox(4096, "Snoop Dogg", ($cool1))
Instead of calling these three functions, you can create a function for example _ShowText($sText) here is an example:
Func _ShowText($sText)
shellexecute("c:/windows/chatterbots/Snoop Dogg.mp4")
Sleep(Random(6131,6132, 1))
MsgBox(4096, "Snoop Dogg", $sText)
EndFunc
Suggestions:
In other cases, when I'm talking to the bot it tells me that the video can't be found, obviously because I don't have it. It would be nice if this video playback and sleep time is optional.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...