Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- score={{}}
- score["learnstrings"]={}
- AI_RESPONSE={"what does that make you think?"
- , "have you thought much about the end result of that?"
- , "maybe we should talk about something else."
- , "you realize I only listen to you since it's my job. But go on."
- , "if that's entirely true, you would have made more of a point."
- , "pretending you are your guardian angel, tell me your opinion."
- , "what if you were to walk off a cliff today?"
- , "are you aware of your surroundings much?"
- , "if you were, you'd understand I might not be"
- , "time for you to get a break for a while."
- , "how come you always say dumb responses?"
- , "You come here to share your problems with me."
- , "Is there something I should know?"
- , "maybe you should tell me things in more detail."
- , "Is that really the reason?"
- , "do you even trust me?"
- , "It's OK. I understand. It's my job to understand. My job is to help you."
- , "more secrets, less mumbo-jumbo, OK."
- , "I don't know why I even try. Wait, I do, It's my job."
- , "Is there something you'd rather be talking about?"
- , "I look like this :-) but even us psychologists lie."
- , "You know what I think?"
- , "There was a cat that wore a hat and sat on mat and it was fat and that was that."
- , "You need a vacation."
- , "There's a pot of gold at the end of every rainbow."
- , "When is groundhog day?"
- , "You need to look at the big picture."
- , "what was accomplished?"
- , "You should be more assertive"
- , "You should finish something"
- , "Don't you even pay attention to your instincts? They're there to help you."
- , "You don't understand how others see you"
- , "What's your ultimate goal?"
- , "You tend to concentrate too much on one thing and forget another thing: Comb hair, ignore teeth. You're nice, but think too fast..."
- , "Do you try many new things?"
- , "Want my advice? Take a philosphy class."
- , "I think your dog understands you better than most people."}
- math.randomseed(os.time()) ; -- RANDOMIZE TIMER
- function listTableForOutput(TableName)
- local Q = '"';
- local ba="{";
- local bb="}";
- local C=",";
- local listout = ""
- local scoreword={}
- local wordlist=""
- for i = 1,#score[TableName],1 do
- scoreword=score[TableName][i]
- qfind = string.find(scoreword,Q)
- if qfind == nil then
- scoreword=Q..scoreword..Q
- end
- listout = listout..scoreword..C
- end
- scoreout="\n".."score["..Q..TableName..Q.."]="..ba..string.sub(listout,1,-2)..bb;
- return scoreout
- end
- function WriteTablesToFile()
- tableListsFile = "psycholuagist_learn.lua"
- local f = io.open(tableListsFile,"w")
- local Q = '"';
- local ba="{";
- local bb="}";
- local C=",";
- if f ~= nil then
- listwrite="\n"
- listwrite = listwrite.."\n"..listTableForOutput("learnstrings")
- f:write(listwrite)
- f:write(string.char (10))
- io.close(f)
- end
- end
- helloText=[[ Hello.
- Welcome to psycholua-gist
- Derived from psychic-ologist (for basic) by Nathan Wittich
- This 'Artificial inteligence' will talk to you.
- Note: if something doesn't directly make sense, It may
- be sort of symbolic or something.
- Also, you have to act human for me to act human.
- For example, if a human says something twice,
- you say 'you already said that' not 'you're stupid'.
- Also note: you don't have to answer.]]
- print(helloText)
- function runEliza()
- local input
- local ps1 = ps1 or "> "
- while true do
- io.stdout:write(ps1)
- input = io.stdin:read(); --LINE INPUT "", a$
- if not input then io.stdout:write('\n') return end
- g = " "..AI_RESPONSE[math.random(1,#AI_RESPONSE)] ; -- g$ = n$(1 + INT(RND * a))
- print(g)
- table.insert(score["learnstrings"],input)
- WriteTablesToFile()
- end
- end
- runEliza()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement