finish eliza
This commit is contained in:
parent
d7d9e71d67
commit
f2f557d045
215
sandbox.ld
215
sandbox.ld
|
@ -25,90 +25,261 @@ fn repersonalize (x) -> do x >
|
||||||
map (switch_persons, _) >
|
map (switch_persons, _) >
|
||||||
join (_, " ")
|
join (_, " ")
|
||||||
|
|
||||||
|
fn one_of {
|
||||||
|
(str as :string) -> str
|
||||||
|
(strs as :list) -> random (strs)
|
||||||
|
}
|
||||||
|
|
||||||
let output = match padded with {
|
let output = match padded with {
|
||||||
"{x} hello {y}" -> "How do you do. Please state your problem"
|
"{x} hello {y}" -> "How do you do. Please state your problem"
|
||||||
"{x} hi {y}" -> "How do you do. Please state your problem"
|
"{x} hi {y}" -> "How do you do. Please state your problem"
|
||||||
"{x} computer {y}" -> random ([
|
"{x} computer {y}" -> [
|
||||||
"Do computers worry you"
|
"Do computers worry you"
|
||||||
"What do you think about machines"
|
"What do you think about machines"
|
||||||
"Why do you mention computers"
|
"Why do you mention computers"
|
||||||
"What do you think machines have to do with your problem"
|
"What do you think machines have to do with your problem"
|
||||||
])
|
]
|
||||||
"{x} name {y}" -> "I am not interested in names"
|
"{x} name {y}" -> "I am not interested in names"
|
||||||
"{x} sorry {y}" -> random ([
|
"{x} sorry {y}" -> [
|
||||||
"Please don't apologize"
|
"Please don't apologize"
|
||||||
"Apologies are not necessary"
|
"Apologies are not necessary"
|
||||||
"What feelings do you have when you apologize"
|
"What feelings do you have when you apologize"
|
||||||
])
|
]
|
||||||
"{x} i remember {y}" -> {
|
"{x} i remember {y}" -> {
|
||||||
let switched = repersonalize (y)
|
let switched = repersonalize (y)
|
||||||
random ([
|
[
|
||||||
"Do you often think of {switched}"
|
"Do you often think of {switched}"
|
||||||
"Does thinking of {switched} bring anything else to mind"
|
"Does thinking of {switched} bring anything else to mind"
|
||||||
"What else do you remember"
|
"What else do you remember"
|
||||||
"Why do you recall {switched} right now"
|
"Why do you recall {switched} right now"
|
||||||
"What in the present situation reminds you of {switched}"
|
"What in the present situation reminds you of {switched}"
|
||||||
"What is the connection between me and {switched}"
|
"What is the connection between me and {switched}"
|
||||||
])
|
]
|
||||||
}
|
}
|
||||||
"{x} do you remember {y}" -> {
|
"{x} do you remember {y}" -> {
|
||||||
let switched = repersonalize (y)
|
let switched = repersonalize (y)
|
||||||
random ([
|
[
|
||||||
"Did you think I would forget {switched}"
|
"Did you think I would forget {switched}"
|
||||||
"Why do you think I should recall {switched} now"
|
"Why do you think I should recall {switched} now"
|
||||||
"What about {switched}"
|
"What about {switched}"
|
||||||
"You mentioned {switched}"
|
"You mentioned {switched}"
|
||||||
])
|
]
|
||||||
}
|
}
|
||||||
"{x} if {y}" -> {
|
"{x} if {y}" -> {
|
||||||
let switched = repersonalize (y)
|
let switched = repersonalize (y)
|
||||||
random ([
|
[
|
||||||
"Do you reall think that its likely that {switched}"
|
"Do you reall think that its likely that {switched}"
|
||||||
"Do you wish that {switched}"
|
"Do you wish that {switched}"
|
||||||
"What do you think about {switched}"
|
"What do you think about {switched}"
|
||||||
"Really--if {switched}"
|
"Really--if {switched}"
|
||||||
])
|
]
|
||||||
}
|
}
|
||||||
"{x} i dreamt {y}" -> {
|
"{x} i dreamt {y}" -> {
|
||||||
let switched = repersonlize (y)
|
let switched = repersonalize (y)
|
||||||
random ([
|
[
|
||||||
"Really--{y}"
|
"Really--{y}"
|
||||||
"Have you ever fantasized {y} while you were awake"
|
"Have you ever fantasized {y} while you were awake"
|
||||||
"Have you dreamt {y} before"
|
"Have you dreamt {y} before"
|
||||||
])
|
]
|
||||||
}
|
}
|
||||||
"{x} dream about {y}" -> {
|
"{x} dream about {y}" -> {
|
||||||
let switched = repersonalize (y)
|
let switched = repersonalize (y)
|
||||||
"How do you feel about {switched} in reality"
|
"How do you feel about {switched} in reality"
|
||||||
}
|
}
|
||||||
"{x} dream {y}" -> random ([
|
"{x} dream {y}" -> [
|
||||||
"What does this dream suggest to you"
|
"What does this dream suggest to you"
|
||||||
"Do you dream often"
|
"Do you dream often"
|
||||||
"What persons appear in your dreams"
|
"What persons appear in your dreams"
|
||||||
"Don't you believe that dream has to do with your problem"
|
"Don't you believe that dream has to do with your problem"
|
||||||
])
|
]
|
||||||
"{x} my mother {y}" -> {
|
"{x} my mother {y}" -> {
|
||||||
let switched = repersonalize (y)
|
let switched = repersonalize (y)
|
||||||
random ([
|
[
|
||||||
"Who else in your family {y}"
|
"Who else in your family {y}"
|
||||||
"Tell me more about your family"
|
"Tell me more about your family"
|
||||||
])
|
]
|
||||||
}
|
}
|
||||||
"{x} my father {y}" -> random ([
|
"{x} my father {y}" -> [
|
||||||
"Your father"
|
"Your father"
|
||||||
"Does he influence you strongly"
|
"Does he influence you strongly"
|
||||||
"What else comes to mind when you think of your father"
|
"What else comes to mind when you think of your father"
|
||||||
])
|
]
|
||||||
_ -> random ([
|
"{x} i want {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
[
|
||||||
|
"What would it mean if you got {y}"
|
||||||
|
"Why do you want {y}"
|
||||||
|
"Suppose you got {y} soon"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"{x} i am glad {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
[
|
||||||
|
"How have I helped you to be {y}"
|
||||||
|
"What makes you happy just now"
|
||||||
|
"Can you explain why you are suddenly {y}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"{x} i am sad {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
[
|
||||||
|
"I am sorry to hear you are depressed"
|
||||||
|
"I'm sure it's not pleasant to be sad"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"{x} are like {y}" -> {
|
||||||
|
let switched_x = repersonalize (x)
|
||||||
|
let switched_y = repersonalize (y)
|
||||||
|
"What resemblance to you see between {switched_x} and {switched_y}"
|
||||||
|
}
|
||||||
|
"{x} is like {y}" -> {
|
||||||
|
let switched_x = repersonalize (x)
|
||||||
|
let switched_y = repersonalize (y)
|
||||||
|
[
|
||||||
|
"In what way is it that {switched_x} is like {switched_y}"
|
||||||
|
"What resemblance do you see"
|
||||||
|
"Could there really be some connection"
|
||||||
|
"How"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"{x} alike {y}" -> [
|
||||||
|
"In what way"
|
||||||
|
"What similarities are there"
|
||||||
|
]
|
||||||
|
"{x} same {y}" -> "What other connections do you see"
|
||||||
|
"{x} i was {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
[
|
||||||
|
"Were you really"
|
||||||
|
"Perhaps I already knew you were {switched}"
|
||||||
|
"Why do you tell me you were {switched} now"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"{x} was i {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
[
|
||||||
|
"What if you were {switched}"
|
||||||
|
"Do you think you were {switched}"
|
||||||
|
"What wouuld it mean if you were {switched}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"{x} i am {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
[
|
||||||
|
"In what way are you {switched}"
|
||||||
|
"Do you want to be {switched}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"{x} am i {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
[
|
||||||
|
"Do you believe you are {switched}"
|
||||||
|
"Would you want to be {switched}"
|
||||||
|
"You wish I would tell you you are {switched}"
|
||||||
|
"What would it mean if you were {switched}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"{x} am {y}" -> [
|
||||||
|
"Why do you say *AM*"
|
||||||
|
"I don't understand that"
|
||||||
|
]
|
||||||
|
"{x} are you {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
[
|
||||||
|
"Why are you interested in whether I am {switched} or not"
|
||||||
|
"Would you prefer if I weren't {switched}"
|
||||||
|
"Perhaps I am {switched} in your fantasies"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"{x} you are {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
"What makes you think I am {y}"
|
||||||
|
}
|
||||||
|
"{x} because {y}" -> [
|
||||||
|
"Is that the real reason"
|
||||||
|
"What other reasons might there be"
|
||||||
|
"Does that reason seem to explain anything else"
|
||||||
|
]
|
||||||
|
"{x} were you {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
[
|
||||||
|
"Perhaps I was {switched}"
|
||||||
|
"What od you think"
|
||||||
|
"What if I had been {switched}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"{x} i can't {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
[
|
||||||
|
"Maybe you could {switched} now"
|
||||||
|
"What if you could {switched}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"{x} i feel {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
"Do you often feel {switched}"
|
||||||
|
}
|
||||||
|
"{x} i felt {y}" -> "What other feelings do you have"
|
||||||
|
"{x} i {y} you {z}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
"Perhaps in your fantasy we {switched} each other"
|
||||||
|
}
|
||||||
|
"{x} why don't you {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
[
|
||||||
|
"Should you {y} yourself"
|
||||||
|
"Do you believe I don't {y}"
|
||||||
|
"Perhaps I will {y} in good time"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"{x} yes {y}" -> [
|
||||||
|
"You seem quite positive"
|
||||||
|
"You are sure"
|
||||||
|
"I understand"
|
||||||
|
]
|
||||||
|
"{x} no {y}" -> [
|
||||||
|
"Why not"
|
||||||
|
"You are being a bit negative"
|
||||||
|
"Are you saying *NO* just to be negative"
|
||||||
|
]
|
||||||
|
"{x} someone {y}" -> "Can you be more specific"
|
||||||
|
"{x} everyone {y}" -> [
|
||||||
|
"Surely not everyone"
|
||||||
|
"Can you think of anyone in particular"
|
||||||
|
"Who for example"
|
||||||
|
"You are thinking of a special person"
|
||||||
|
]
|
||||||
|
"{x} always {y}" -> [
|
||||||
|
"Can you think of a specific example"
|
||||||
|
"When"
|
||||||
|
"What incident are you thinking of"
|
||||||
|
"Really--always"
|
||||||
|
]
|
||||||
|
"{x} what {y}" -> [
|
||||||
|
"Why do you ask"
|
||||||
|
"Does that question interest you"
|
||||||
|
"What is it you really want to know"
|
||||||
|
"What do you think"
|
||||||
|
"What comes to your mind when you ask that"
|
||||||
|
]
|
||||||
|
"{x} perhaps {y}" -> "You do not seem quite certain"
|
||||||
|
"{x} are {y}" -> {
|
||||||
|
let switched = repersonalize (y)
|
||||||
|
[
|
||||||
|
"Did you think they might not be {switched}"
|
||||||
|
"Possibly they are {switched}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
_ -> [
|
||||||
"Very interesting"
|
"Very interesting"
|
||||||
"I am not sure I understand you fully"
|
"I am not sure I understand you fully"
|
||||||
"What does that suggest to you"
|
"What does that suggest to you"
|
||||||
"Please continue"
|
"Please continue"
|
||||||
"Go on"
|
"Go on"
|
||||||
"Do you feel strongly about discussing such things"
|
"Do you feel strongly about discussing such things"
|
||||||
])
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
print! (">>> ", upcase (output))
|
print! (">>> ", do output > one_of > upcase)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,9 @@
|
||||||
(set (out :draw) (post :draw))
|
(set (out :draw) (post :draw))
|
||||||
(-> out j/encode string))
|
(-> out j/encode string))
|
||||||
|
|
||||||
(comment
|
# (comment
|
||||||
# (do
|
(do
|
||||||
(def source `let foo = foo bar baz`)
|
(def source (slurp "sandbox.ld"))
|
||||||
(def out (-> source
|
(def out (-> source
|
||||||
ludus
|
ludus
|
||||||
j/decode))
|
j/decode))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user