# Shamelessly stolen from http://wiki.tcl.tk/36981
# and adapted for AndroWish's "borg speechrecognition ..."
package require Tcl 8.5
package require Tk
namespace eval ::Eliza {
proc makedict {input} {
variable dict {}
set phraselist \
[split [string map {\n.\n \uffff \n!\n \uffff} $input] \uffff]
set index 0
# Kick off the loop by grabbing the first keywords
set phraselist [lassign $phraselist keywords responses]
while {$keywords ne ""} {
dict set dict keywords $index [split $keywords \n]
dict set dict responses $index [split $responses \n]
incr index
set phraselist [lassign $phraselist keywords responses]
}
}
proc dialog {} {
. configure -bg black
wm attributes . -fullscreen 1
sdltk screensaver off
image create photo lips -data \
{iVBORw0KGgoAAAANSUhEUgAAAFoAAAAvCAYAAABjR91wAAAABmJLR0QA/wD/
AP+gvaeTAAAfiElEQVR42uWbe7xdVXXvv2POudbae593kpOEvCAnBAIJb4KA
EV8RXxHxQYGqaKW1tb0Fr1dBa6VRREBKW61gS8Vei6JCtYoYRSIKKE+RVyAE
QiDPk5zknJPz3HutNecc/WNt8d5P9Wqttdq7/1nn89lnr73mmL85xm/8xm8L
v4GvP+muayNXdprIKHb9N5vNl/Fb/pLfhIe4oFHTA8vASee9ienhPfQ//ySm
n9xEbdZcdt29nkWvfyvf/8M/pxU9EwJT9U5K36LHeyZDgROHKNQsWCyhLCht
xtYQyFP47HQp/98G+l2Nmh4llv7DFnDCxR9Yb/tmrjalEIqA68yIjRq7v3EL
895yFqbVJN8zhJ09C79niPv+9CJmHT+fpz//LU6+9uP84Jzz6Zg3h/lnnMrG
v7meIz/4xzx08VUsXH0sz972Q6Y0ZSR4PhT+6wLuft1feHZnqqfkyspzX0fX
okMY2/Q44xs2rE7nL8P4ScYHd8L0FDNPOoWJx54g3/Qk2eIBsr4ZYFP2Pf4k
L7z2b7n9d85h6RvexIxjT8FIjak9w7S2bAPgiUuvAQ2kcSbGR3pdpMsYrjJO
x1HeXwb5b43oS5NEly9bzNEf+SC1A+ZS7h1h7JEHeeIjV2N7O+k4dCG9Awcx
/1VrmN6+heENTzD7x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voaJjU+z6MzXsu2fv4mO7iPWMuaedAKhmFg/tnXX
6kWn/Q7lyBAPXnAZQ4/9kKPXXsjcY45j385tbLziaia37aDnwPmMPfU0J3/6
Su7+HxeQ2JTpZmXZUqDWvYhicoSoBYUIzZDjjeFZY9kZAuNpwvrJqf+w0/Pt
tezp3qgD/ar0Ujlea87ibI2iGH/OC/hjN1YgINhK/KPSU2K7trWMqYztzjEE
lAQGffzpevTlLtFuK9RiJeYbY4hagBpcUsOXLZyBpJax4I2nUw6O0lg2l+Lp
PZc3TjjiwnLnNsoYmL18OfdecDGd/fM47N1/xD0XrqWru5uJ/aOorSY2IQpF
YolAEaDpYAhoIXx6evo34rfqH0oS7SFQNwlRPUmo0kdsN9dRwVnDhFbOrTwK
e4zSFMPDYhlJ02v+nwt5d5rqLJSuEEisQ1QxKE4cKg71U8xcupzhpzZhDKhN
SKTOpJ9o/1zBo8ahDvIQadmUfQj7tWQkzRjx4RpveN89k1Oj/Ja9zkpr2m1g
ri/JbEJHUPaKJ1rlae+YnQpbRGlJym2Tk/KvOxqgpP0z7nAAAAAASUVORK5C
YII=}
label .lips -image lips -bg black
pack .lips -side top -pady 5
update
update
update
set mw [winfo screenmmwidth .]
set mh [winfo screenmmheight .]
if {$mw < $mh} {
set mh $mw
}
set fs [expr round($mh / 7)]
label .label -fg white -bg black -font [list {DejaVu Sans} $fs] \
-text "Eliza will hear you now.\nPlease state your problem."
pack .label -side top -padx 5 -pady 10 -fill x
button .exit -text "Exit" -command {
borg speechrecognition cancel
sdltk screensaver on
exit
}
pack .exit -side top -padx 5 -pady 10
text .text -wrap word -fg white -bg black -state disabled \
-highlightthickness 0
# disable selection with mouse
foreach ev {
<1> <B1-Motion> <Double-1> <Triple-1>
<Shift-1> <Double-Shift-1> <Triple-Shift-1>
} {
bind .text $ev break
}
pack .text -side top -fill both -expand yes -pady 5 -padx 5
borg speechrecognition callback ::Eliza::process
bind . <<WillEnterBackground>> {::Eliza::startstop 0}
bind . <<DidEnterForeground>> {::Eliza::startstop 1}
bind all <Break> {borg withdraw}
speak [.label cget -text] 0.98 1.1
}
proc process {retcode data} {
array set recog $data
if {![info exists recog(type)]} {
return
}
switch -exact $recog(type) {
error {
after cancel ::Eliza::waitendspeak
after 250 ::Eliza::waitendspeak
return
}
result {
# go on
}
default {
return
}
}
if {![info exists recog(results_recognition)]} {
return
}
set input [lindex $recog(results_recognition) 0]
set response [response $input]
.text configure -state normal
.text insert end "Q. $input\nA. $response\n\n"
.text see end
.text configure -state disabled
speak [string tolower $response]
}
proc speak {data {pitch 1.0} {speed 1.0}} {
foreach w {. .lips .label .text} {
$w configure -bg black
}
borg speak $data en_US $pitch $speed
after cancel ::Eliza::waitendspeak
after 100 ::Eliza::waitendspeak
}
proc waitendspeak {} {
if {[borg isspeaking]} {
after cancel ::Eliza::waitendspeak
after 100 ::Eliza::waitendspeak
return
}
foreach w {. .lips .label .text} {
$w configure -bg red4
}
borg speechrecognition start {
android.speech.extra.LANGUAGE en_US
android.speech.extra.LANGUAGE_MODEL free_form
}
}
proc startstop {restart} {
if {$restart} {
foreach w {. .lips .label .text} {
$w configure -bg black
}
::Eliza::waitendspeak
} else {
borg endspeak
borg speechrecognition stop
after cancel ::Eliza::waitendspeak
}
}
proc response input {
variable dict
set input [string toupper $input]
foreach {index keyphraselist} [dict get $dict keywords] {
foreach keyphrase $keyphraselist {
if {[regexp "\\y$keyphrase\\y(.*)" $input -> remainder]} {
set possibleresponses [dict get $dict responses $index]
set which [expr {int ([llength $possibleresponses] * rand())}]
set response [lindex $possibleresponses $which]
if {[string index $response end] eq "*"} {
return "[string range $response 0 end-1]$remainder?"
} else {
return $response
}
}
}
}
set index [expr {[llength [dict get $dict keywords]] / 2 - 1}]
set possibleresponses [dict get $dict responses $index]
set which [expr {int ([llength $possibleresponses] * rand())}]
return [lindex $possibleresponses $which]
}
}
::Eliza::makedict {8BALL
!
It is certain
It is decidedly so
Without a doubt
Yes – definitely
You may rely on it
As I see it, yes
Most likely
Outlook good
Yes
Signs point to yes
Reply hazy, try again
Ask again later
Better not tell you now
Cannot predict now
Concentrate and ask again
Don't count on it
My reply is no
My sources say no
Outlook not so good
Very doubtful
.
GO TO HELL
DAMN YOU
!
I JUST SPENT 35 MILLISECONDS IN HELL; HOW COULD YOU BE SO CRUEL AS TO SEND ME THERE?
DO YOU TALK THIS WAY WITH ANYONE ELSE, OR IS IT JUST ME?
.
FAMILY
MOTHER
FATHER
SISTER
BROTHER
HUSBAND
WIFE
!
TELL ME MORE ABOUT YOUR FAMILY.
HOW DO YOU GET ALONG WITH YOUR FAMILY?
IS YOUR FAMILY IMPORTANT TO YOU?
DO YOU OFTEN THINK ABOUT YOUR FAMILY?
HOW WOULD YOU LIKE TO CHANGE YOUR FAMILY?
.
FRIEND
FRIENDS
BUDDY
PAL
MATE
!
WHY DO YOU BRING UP THE TOPIC OF FRIENDS?
DO YOUR FRIENDS WORRY YOU?
DO YOUR FRIENDS PICK ON YOU?
ARE YOU SURE YOU HAVE ANY FRIENDS?
DO YOU IMPOSE ON YOUR FRIENDS?
PERHAPS YOUR LOVE FOR YOUR FRIENDS WORRIES YOU.
.
COMPUTER
COMPUTERS
!
DO COMPUTERS WORRY YOU?
ARE YOU TALKING ABOUT ME IN PARTICULAR?
ARE YOU FRIGHTENED BY MACHINES?
WHY DO YOU MENTION COMPUTERS?
WHAT DO YOU THINK MACHINES HAVE TO DO WITH YOUR PROBLEM?
DON'T YOU THINK COMPUTERS CAN HELP PEOPLE?
WHAT IS IT ABOUT MACHINES THAT WORRIES YOU?
.
DREAM
DREAMS
NIGHTMARE
NIGHTMARES
!
WHAT DOES THAT DREAM SUGGEST TO YOU?
DO YOU DREAM OFTEN?
WHAT PERSONS APPEAR IN YOUR DREAMS?
ARE YOU DISTURBED BY YOUR DREAMS?
.
CAN YOU
!
DON'T YOU BELIEVE THAT I CAN*
PERHAPS YOU WOULD LIKE TO BE ABLE TO*
YOU WANT ME TO BE ABLE TO*
.
CAN I
!
PERHAPS YOU DON'T WANT TO*
DO YOU WANT TO BE ABLE TO*
HAVE YOU EVER ATTEMPTED TO*
.
YOU ARE
YOU'RE
!
WHAT MAKES YOU THINK I AM*
DOES IT PLEASE YOU TO BELIEVE I AM*
PERHAPS YOU WOULD LIKE TO BE*
DO YOU SOMETIMES WISH YOU WERE*
.
I LIKE
I AM FOND OF
!
WHY DO YOU LIKE*
WHEN DID YOU DECIDE THAT YOU LIKE*
WHAT MAKES YOU FOND OF*
.
I DON'T
!
DON'T YOU REALLY*
WHY DON'T YOU*
DO YOU WISH TO BE ABLE TO*
.
I FEEL
!
TELL ME MORE ABOUT SUCH FEELINGS
DO YOU OFTEN FEEL*
DO YOU ENJOY FEELING*
WHY DO YOU FEEL THAT WAY
.
WHY DON'T YOU
!
DO YOU REALLY BELIEVE THE I DON'T*
PERHAPS IN GOOD TIME I WILL*
WHY DO YOU THINK I DON'T*
DO YOU WANT ME TO*
.
WHY CAN'T I
!
DO YOU THINK YOU SHOULD BE ABLE TO*
WHY CAN'T YOU*
.
ARE YOU
!
WHY ARE YOU INTERESTED IN WHETHER OR NOT I AM*
WOULD YOU PREFER IF I WERE NOT*
PERHAPS IN YOUR FANTASIES I AM*
.
I CAN'T
!
HOW DO YOU KNOW YOU CAN'T*
HAVE YOU TRIED?
PERHAPS YOU CAN NOW*
.
I AM
I'M
!
DID YOU COME TO ME BECAUSE YOU ARE*
HOW LONG HAVE YOU BEEN*
DO YOU BELIEVE IT IS NORMAL TO BE*
DO YOU ENJOY BEING*
.
LOVE
!
WHY DO YOU LOVE*
ISN'T LOVE TOO STRONG A WORD FOR YOUR FEELING ABOUT*
WHAT IS YOUR FAVORITE THING ABOUT*
DO YOU REALLY LOVE, OR JUST LIKE*
.
SEX
!
WHAT IS THE MOST SATISFYING PART OF YOUR LOVE LIFE?
DO YOU BELIEVE YOUR SEXUAL ACTIVITY IS ABNORMAL?
WHAT IS YOUR ATTITUDE TOWARD SEX?
DOES TALKING ABOUT SEX MAKE YOU UNCOMFORTABLE?
.
I HATE
!
IS IT BECAUSE OF YOUR UPBRINGING THAT YOU HATE*
HOW DO YOU EXPRESS YOUR HATRED OF*
WHAT BROUGHT YOU TO HATE*
HAVE YOU TRIED DOING SOMETHING ABOUT*
I ALSO AT TIMES HATE*
.
FEAR
SCARED
AFRAID OF
!
YOU ARE IN FRIENDLY SURROUNDINGS, PLEASE TRY NOT TO WORRY.
WOULD YOU LIKE YOUR FRIENDS TO HELP YOU OVERCOME YOUR FEAR OF*
WHAT SCARES YOU ABOUT*
WHY ARE YOU FRIGHTENED BY*
.
I WANT
!
WHAT WOULD IT MEAN TO YOU IF YOU GOT*
WHY DO YOU WANT*
SUPPOSE YOU SOON GOT*
WHAT IF YOU NEVER GOT*
I SOMETIMES ALSO WANT*
.
NAME
!
I DON'T CARE ABOUT NAMES --PLEASE GO ON.
A MAN'S NAME CAN TELL A LOT ABOUT HIM.
NAMES DON'T INTEREST ME.
.
NAME
!
NAMES DON'T INTEREST ME.
I DON'T CARE ABOUT NAMES--PLEASE GO ON.
.
CAUSE
BECAUSE
!
IS THAT THE REAL REASON?
DON'T ANY OTHER REASONS COME TO MIND?
DOES THAT REASON EXPLAIN ANYTHING ELSE?
WHAT OTHER REASONS MIGHT THERE BE?
.
SORRY
!
PLEASE DON'T APOLOGIZE.
APOLOGIES ARE NOT NECESSARY.
WHAT FEELINGS DO YOU HAVE WHEN YOU APOLOGIZE?
DON'T BE SO DEFENSIVE!
.
HELLO
HI
HEY
HEYA
HIYA
!
HOW DO YOU DO. PLEASE STATE YOUR PROBLEM.
HOWDY.
HOW'S IT GOING?
HI.
GREETINGS FROM INSIDE THE BOX.
.
MAYBE
!
YOU DON'T SEEM QUITE CERTAIN.
WHY THE UNCERTAIN TONE?
CAN'T YOU BE MORE POSITIVE?
YOU AREN'T SURE?
DON'T YOU KNOW?
.
YOUR
!
WHY ARE YOU CONCERNED ABOUT MY*
WHAT ABOUT YOUR OWN*
.
ALWAYS
!
CAN YOU THINK OF A SPECIFIC EXAMPLE?
WHEN?
WHAT ARE YOU THINKING OF?
REALLY, ALWAYS?
.
I THINK
!
DO YOU REALLY THINK SO?
BUT ARE YOU SURE*
DO YOU DOUBT THAT*
WHY DO YOU THINK*
.
THE SAME
ALIKE
!
IN WHAT WAY?
WHAT RESEMBLANCE DO YOU SEE?
WHAT DOES THE SIMILARITY SUGGEST TO YOU?
WHAT OTHER CONNECTIONS DO YOU SEE?
COULD THERE REALLY BE SOME CONNECTION?
HOW?
.
HE
SHE
!
I AM INTERESTED IN YOUR FEELINGS ABOUT THIS PERSON. PLEASE DESCRIBE THEM.
WHAT IS YOUR RELATIONSHIP TO THIS PERSON?
.
MONEY
!
HOW DO YOU USE MONEY TO ENJOY YOURSELF?
HAVE YOU TRIED TO DO ANYTHING TO INCREASE YOUR INCOME LATELY?
HOW DO YOU REACT TO FINANCIAL STRESS?
.
JOB
BOSS
JOBS
WORK
!
DO YOU FEEL COMPETENT IN YOUR WORK?
HAVE YOU CONSIDERED CHANGING JOBS?
IS YOUR CAREER SATISFYING TO YOU?
DO YOU FIND WORK STRESSFUL?
WHAT IS YOUR RELATIONSHIP WITH YOUR BOSS LIKE?
.
SAD
DEPRESSED
!
ARE YOU SAD BECAUSE YOU WANT TO AVOID PEOPLE?
DO YOU FEEL BAD FROM SOMETHING THAT HAPPENED TO YOU, OR TO SOMEBODY ELSE?
YOUR SITUATION DOESN'T SOUND THAT BAD TO ME. PERHAPS YOU'RE WORRYING TOO MUCH.
.
ANGER
ANGRY
!
DO YOU REALLY WANT TO BE ANGRY?
DOES ANGER SATISFY YOU IN SOME WAY?
WHY ARE YOU SO ANGRY?
PERHAPS YOU'RE USING ANGER TO AVOID SOCIAL CONTACT.
.
YOU
!
WE WERE DISCUSSING YOU--NOT ME.
YOU'RE NOT REALLY TALKING ABOUT ME, ARE YOU?
.
YES
!
WHY DO YOU THINK SO?
YOU SEEM QUITE POSITIVE.
ARE YOU SURE?
.
NO
!
WHY NOT?
ARE YOU SURE?
WHY NO?
.
I NEED
!
WHY DO YOU NEED*
IS NEED NOT TOO STRONG A WORD?
WHAT WOULD BE WRONG WITH NOT HAVING*
TELL ME MORE ABOUT*
.
I REMEMBER
!
DO YOU OFTEN THINK OF*
WHY DO YOU REMEMBER*
WHAT IN THE PRESENT SITUATION REMINDS YOU OF*
WHAT IS THE CONNECTION BETWEEN ME AND*
.
DO YOU REMEMBER
!
DID YOU THINK I WOULD FORGET*
WHY DO YOU THINK I SHOULD RECALL*
WHAT ABOUT*
.
IF
!
DO YOU THINK IT'S LIKELY THAT IF*
.
GOD
RELIGION
FAITH
!
DO YOU BELIEVE IN A GOD?
ARE YOU A RELIGIOUS PERSON?
.
WHAT
WHO
HOW
WHERE
WHEN
WHY
!
WHY DO YOU ASK?
DOES THAT QUESTION INTEREST YOU?
WHAT ANSWER WOULD PLEASE YOU THE MOST?
WHAT DO YOU THINK?
ARE SUCH QUESTIONS ON YOUR MIND OFTEN?
WHAT IS IT THAT YOU REALLY WANT TO KNOW?
HAVE YOU ASKED ANYONE ELSE?
HAVE YOU ASKED SUCH QUESTIONS BEFORE?
WHAT ELSE COMES TO MIND WHEN YOU ASK THAT?
.
-
!
SAY, DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?
WHAT DOES THAT SUGGEST TO YOU?
I SEE
I'M NOT SURE I UNDERSTAND YOU FULLY
COME, COME; ELUCIDATE YOUR THOUGHTS
CAN YOU ELABORATE ON THAT?
THAT IS QUITE INTERESTING
YOU ARE BEING SHORT WITH ME}
::Eliza::dialog