.he 'PARRY''Page %'
.fo 'Steven Hardy'- % -'October 1977'
.ce 2
A 'Paranoid' program
====================
.tp 5
.sp
This handout describes a way of converting some of the ideas 
underlying K. Colby's PARRY program into POP11. You should
read the ELIZA demo and glance at the PFUNCTION demo before reading
this. This particular handout concentrates on the linguistic ability
of PARRY, since I don't find PARRY a particularly convincing theory
of paronoia.
.bb
The program described here is like ELIZA in that it matches its
input against a series of 'stimulus - response' pairs. One difference
between ELIZA and PARRY is that the latter preprocesses its input
before matching; this preprocessing  consists of replacing input
words
by 'root words'. For example, words like AM, IS, WAS, ARE
are all replaced by BE (all tense information is removed from verbs);
words like MY, MINE, I are replaced by I; unrecognised words
are removed from the input. 
So, for example, the sentences:
 	: IS YOUR MOTHER A HAPPY PERSON
 	: WHAT IS YOUR CURRENT OCCUPATION
 	: HOW LONG HAVE YOU BEEN HERE IN THE HOSPITAL
.br
get simplified to
 	: BE YOU MOTHER HAPPY:
 	: WHAT BE YOU JOB
 	: HOW LONG YOU BE HOSPITAL
.br
Notice that the word OCCUPATION is mapped onto the word JOB.
.tp 5
.sp
The rather unsympathetic attitude to language
adopted by PARRY
has
the advantage that a single stored pattern now matches a greater variety
of input sentences.
.tp 5
.sp
The CENSOR demo describes one stage of morphemic analysis
(i.e. reducing words to their 'stems').
.bb
A second feature of PARRY, is that it has an 'emotional state'.
This state is represented by a number of 'affect variables' like
FEAR, ANGER, MISTRUST etc. These vary between 0 and 1 (i.e. a FEAR
level of 0.9 represents a terrified
PARRY, a MISTRUST level of 0.2 represents a trusting one).
We can make use of these variables, to restrict the applicability
of particular stimulus-response pairs, for example:
 	: PFUNCT1ON MI([I BE SORRY]);
 	:	 IF MISTRUST > 0.5 THEN
 	:		 0.7 -> ANGER;
 	:		 [GO TO HELL]
 	:	 CLOSE
 	: END;
 	: PFUNCTION M2([I BE SORRY]);
 	:	 IF MISTRUST <= 0.5 THEN
 	:		 MISTRUST / 2 -> MISTRUST;
 	:		 [THATS OKAY]
 	:	 CLOSE
 	: END;
.br
.tp 5
.sp
Both these routines are relevant to apologies, but only if
PARRY 'trusts' its user is an apology 'accepted' (leading
to an even more trusting 'relationship').
If PARRY mistrusts its user, the apology is rudely rejected and
PARRY gets 'angry'.
.tp 5
.sp
It is possible to design PARRY so that it can get stuck in an angry,
mistrustful state. Once in this state, nothing can placate it, for
all overtures of friendliness are rejected.
.bb
No doubt, you can elaborate on the mechanisms hinted at above.
.tp 5
.sp
I am
worried by what it is that these affect variables are supposed 
to be representing. One possibility is that they represent hormonal
levels in the brain. For example, 
FEAR might represent the amount of adrenalin in PARRY'S 'brain'.
In that event statements like
 	: IF FEAR > 0.7 THEN ... CLOSE
.br
are
modelling chemical reactions. This is an important feature of
AI programming. A computer executing a conditional statement is not
the same as chemicals reacting, but this doesn't matter for
we are concerned with simulating the psychology of minds - 
not their physiology.
.tp 5
.sp
Notice that PARRY 
can be designed so that the only way of changing its
state of mind once it is locked in a paranoid state is to
directly alter the value of its affect variables (by giving it 'drugs`?).
.bb
PARRY can be made to handle simple anaphora (i.e. use of words like 
IT and THAT).
Consider:
 	: PFUNCTION J1([WHAT BE YOU JOB]);
 	:	"JOB" -> TOPIC;
 	:	 [ I AM A FITTER AT CONSOLIDATED IRON];
 	: END;
 	: PFUNCTION J2([HOW LONG YOU BE JOB]);
 	:	"JOB" -> TOPIC;
 	:	 [I HAVE WORKED THERE FOR THREE YEARS];
 	: END;
.br
.tp 5
.sp
Can you think how to modify the pre-processor of PARRY to let it have the
following conversation:
 	: WHAT DO YOU FOR A LIVING
 	** [I AM A FITTER AT CONSOLIDATED IRON]
 	: HOW LONG HAVE YOU BEEN DOING THAT
 	** [I HAVE WORKED THERE FOR THREE YEARS]
.br
.bb
Variables like TOPIC can be used to give PARRY an additional verisimiltude.
Like ELIZA, there must be routines in PARRY to cope with cases
where the input is not recognized. In ELIZA these routines produce
responses like:
 	** [DO GO ON]
 	** [HOW INTERESTING]
.br
Similar routines in PARRY can use the current topic of conversation.
For example if TOPIC is HOBBY, then PARRY mentions HORSERACING, then
GAMBLING, then the MAFIA and will eventually tell you how the
Mafia are out to kill him as he has evidence against their leader.
.tp 5
.sp
There are a variety of topic routes to this tale (for example, POLICE 
leads to MAFIA).
.tp 5
.sp
Associated with each topic, PARRY has a number of controversial(?)
responses ('beliefs`?). For example, the police don`t do their job,
bookies cheat and the Mafia are out to get him. Should the user
express disbelief PARRY becomes MISTRUSTful and ANGRY, thus:
 	: PFUNCTION DB1([BE YOU SURE]);
 	: 	MISTRUST * 5 -> MISTRUST;
 	:	0.7 -> ANGER;
 	:	[YOU DONT BELIEVE ME]
 	: END;
.bb
Can you elaborate on the mechanisms described here to produce a
program capable of a convincing demonstration of paranoia (at least
for a few minutes)?
