communications of the acm 1966 weizenbaum

Upload: moitolixo

Post on 07-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Communications of the ACM 1966 Weizenbaum

    1/10

    : " : i . . : ,- . : : . . . :, : . ..: i i ; ! , : :

    i " " : . ' .. . . . . . . . . . . . . . . .:::: :i

    1 " 5 . " . . . . . . . . : : . . ' ~ ~ . .

    .: . : , :

    . . : . . .

    ompu aI cma " . : : " " " " : ; . i ~ i : :

    E L I Z A A Com p u te r P r ogr amF o r t h e S t u d y o f N a t u ra l L a n g u a g eC o m m u n i c a t i o n B e t w e e n M a nA n d M a c h i n e, J o s E P h ~ V E I Z E N B A U MMassach .uscll s [nsh l -u te q f Tcchnu[ogg,* Cam bridge, M ass .

    E L I Z A is a p r o g r a m o p e r a t i n g w i th i n th e M A C t i m e - s h a r i n gs y s te m a t M I T w h i c h m a k e s c e r t a i n k i n ds o f n a t u r a l l a n g u a g ec o n v e rs a ti o n b e t w e e n m a n a n d c o m p u t e r p o s s i bl e . I n p u t s e n -t e n ce s a r e a n a l y z e d o n t h e b a s is o f d e c o m p o s it io n r u le s w h i c ha r e t r i g g e r e d b y k e y w o r d s a p p e a r i n g in t h e in p u t t e x t .R e s p o n s es a r e g e n e r a t e d b y r e a s s e m b l y r u le s a s s o c i a t e d w i thse lec t ed d eco m p o si t io n ru les . T h e f u n d am en t a l t ech n ica l p ro b -lem s w i t h wh ich EL IZ A is co n cern ed are : ( 1 ) t h e id en t i f i ca t io n o fke y wo rd s , ( 2 ) th e d isco very o f m in im al co n t ex t , ( 3 ) t h e ch o iceo f a p p r o p r i a t e t ra n s fo r m a ti o ns , ( 4 ) g e n e r a t i o n o f r e sp o n s e s i nt h e a b s e n c e o f k e y w o r d s , a n d ( 5 ) t h e p r o v i s i o n o f a n e d i t i n gc a p a b i l i t y f o r E L I Z A " s c ri p ts " . A d i s cu s s io n o f s o m e p s y c h o l o g i -c a l i s s u es r e l e v a n t t o t h e E L I Z A a p p r o a c h a s w e l l a s o f f u t u r ed e v e l o p m e n t s c o n c l u de s t h e p a p e r .I n t r o d u c t i o n

    I t i s s a i d t h at to e x p l a i n is t o e x p l a i n a w a y . T h i s m a x i mi s n o w h e r e s o w e l l f u l f i l l e d a s i n t h e a r e a o f c o m p u t e rp r o g r a m m i n g , e s p e c i a l ly in w h a t i s e a ll e d h e u r i s t ic p r o -g r a m m i n g a n d a r t i fi e iM i n t e ll i g e n c e . F o r i n t h o s e r e a l m sm a c h i n e s a r e m a d e t o b e h a v e i n w o n d r o u s w a y s , o f t e ns u f t ie i e n t t o d a z z l e e v e n t h e m o s t e x p e r im ~ e e d o b s e r v e r .B u t o n c e a p a r t i c u l a r p r o g r a m i s u n m a s k e d , o n c e it si n n e r w o r k i n g s a r e e x p l a i n e d i n l a n g u a g e s u f f i c i e n t l y p l a i nt o i n d u c e u n d e r s t a n d i n g , i t s m a g i c c r u m b l e s a w a y ; i Ls t~ m d s r e v e a l e d a s a m e r e c o l l e c t i o n o f p r o c e d u r e s , e a c hq u i t e c o m p r e h e n s i b l e . T h e o b s e r v e r s a y s t o h i m s e l f " Ic o u ld h a v e w r i t t e n t h a t " . W i t h t h a t t h o u g h t h e m o v e s t h ep r o g r a m i n q u e s t i o n f r o m t h e s h e l f m ~ t rk e d " i n t e l l i g e n t " ,t o t h a t r e s e r v e d f o r c u r i o s , f i t t o b e d i s c u s s e d o n l y w i t hp e o p l e l e s s e n l i g h t e n e d t h a n h e .

    W o r k r e p o r te d h e r e i n w a s s u p p o r t e d ( iu pr o t ) b y P r o j e c t M A C ,a n _\ -l IT r e s e a r c h p r o g r a m s p o n s o r e d b y t h e A d v m ~ c e d R e s e a r c hP r , , j e c t s A g e t , c y , l ) ~ l )a r ~ m e t ~ t ~ ,1" l ) o f e n s e , u n d e r O f f ic e o f N a v a lR e s e a r c h C o n t r a c t N u m b e r N o r a ' -4 1 0 2( 0 1 ).

    * D e p a r t m e n t o f E l e e i r i e a l E n g i n e e r i n g .3 6 C o m n u t n i e a t i o n s o f t h e . ~ (' ,M

    : - . . .

    . . ..

    : - : ; ; : iA . G . O E T T I N G E R , E d i t o r

    }} }:

    ::

    i. i

    :: {

    iG:

    T i l e o b j e c t o f t h i s p a p e r i s t o c a u s e j u s t s u c h a r e -e v a l n ~ t i o n o f t h e p r o g r a m a b o u t t o b e " e x p l a i n e d " . F ew }

    4p r o g r a m s e v e r n e e d e d i t m o r e .E L I Z A P r o g r a r n }

    E L I Z A i s a p r o g r a m w h i c h m a k e s n a t u r M h m g u a g ec o n v e r s a t i o n w i t h a C o l n p u t e r p o s s ib l e . I t s p r e s e n t im p le -m e n t a t i o n i s o a t h e M A C t i m e - s h a r i n g s y s t e m a t M I T . i:I t i s w r i t t e n i n 5 l A D - S L I P [ 4] f o r t h e I B M 7 0 9 1 . I t s n a m ew a s c h o s e n t o e m p h a s i z e t h a t i t n m y b e i n c r e m e n t a l l yi m p r o v e d b y i t s u s e r s , s i n c e i t s l a n g u a g e a b i l i t i e s m a y b ec o n t i n u a l l y i m p r o v e d b y a " t e a c h e r " . L i k e t h e E l i z a 0!P y g m a l i o n f a m e , i t ( r a n b e m a d e t o a p p e a r e v e n m o r ec i v i l i zed , t , h e r e l a t i o n o f ap p ear an ce t o r ea l i W , h o wev er ,r e m a i n i n g i n ~ h e d o n m i n o f t h e p l a y w r i g h t .

    F o r l l~ e p r e s e n t p u r p o s e i t i s s u f f ic i e n t t o c h a r a c t e r i z et h e ~ [ A ( ) s y s t e m a s o n e w h i c h p e r m i t s a n i n d i v id u a l too p e r a t e a f u l l s e a l e c o m p u t e r f r o m a r e m o t e l y l o c a t e d t y p e -w r i t e r . T h e i n d i v i d u a l o p e r a t o r h a s t h e i l l u s i o n t h a i, h e ist h e s o l e r i s e r o f t h e co m p u t e r co m p l ex , wh i l e i n f acl ~ o t h e r sm a y b e " t i m e - s h a r i n g " t h e s y s t e m w i t h h i m . W h a t i si m p o r t a n t h e r e i s t h a t t h e c o m p u t e r c a n r e a d m e s s ag e st y p e d o n t h e t y p e w r i t e r a n d r e s p o n d b y w r i t i n g o i l t hes a m e i n s t r u m e n t . % ' h e t i m e b e t w e e n t h e c o m p u t e r ' sr e c e i p t o f a m e s s a g e a n d t h e a p p e a r a n c e o f i t s r e s p o n s e i sa f u n c t i o n o f t h e p r o g r a m c o n t r o l l i n g t h e d i a l o g u e a n d o fs u c h M A C s y s t e m p a r m n e t e r s a s t h e n u m b e r o f us er sc u r r e n t l y e o n ' e s p o n d i n g w i t h t h e s y s t e m . T h e s e l a t t e rp a r a m e t e r s g e n e r a l l y c o n t r i b u t e s o l i t t l e t o t h e o v e r a l lr e s p o n s e t i m e t h a t c o n v e r s a t i o n a l i n t e r a c t i o n w i t h t hec o m p u t e r n e e d n e v e r i n v o l ve t r u l y i n t o l e ra b l e d e l a y s .

    W h e n i n c o n v e r s a t i o n w i t h E L I Z A , t i l e u s e r t y p e s i ns o m e s t a t e m e n t o r se t o f s t a t e m e n t s i n n a t m ' a l l a n g u a g eu s i n g n o r m a l p u n e t u a . t i o n a n d s e n t e n c e s t r u c t u r e s . O n l yt h e q u e s t i o n m a r k m a y n o t b e u s e d , b e c a u s e i t is in t e r -p r e t e d a s a li n e d e l e te c h a r a c t e r b y t h e M A C s y s t e m . T h eu s e r ' s s r a t e m e n t i s t e r m i n a t e d b y a d o u b l e c a r r i a g e r e t u r nw h i c h s e r ve s to t u r n e o n t r o l o v e r t o E L I Z A . E L I Z A Ith ena n a l y z e s t h e u s e r 's s t a t e m e n t a n d g e n e r a t e s s o m e r e s p o n s ew h i e h i t t y p e s o u t. . C o n t r o l is t h e n a g a i n w i t h t h e u s e r .

    A l t y p i e a l c o n v e r s a t i o n i s t h e f o l l o w i n g :M e n a r e a l l a l i k e .I N W H A T W A YT h e y ' r e a l w a y s b u g g i n g u s a b o u t s o m e t h i n g o r o t h e r .C A N Y ( )U T H I N K ( H: A S P E C I F I C E X A M P L EW e l l , m y b o y f r i e n d m a d e m e c o m e h e re .Y O U R B O Y F R I E N D M A I ) E Y O U C O M E H E R Et i e s a y s i ' m d e p r e s s e d m u c h o f t h e t i m e . i[ A M S O R R Y T O H E A R Y O U A R E D E P R E S S E D

    % o l u m e 9 / N u m b e r / / J a n u a r y . , 1 96 62 . :

  • 8/3/2019 Communications of the ACM 1966 Weizenbaum

    2/10

    i n e d . i.

    n t , inn:a t _1[I t s n~

    1~:

    d t~t h a t ii

    f a c t o ff:

    c o m p u te

    r o f use s e [~i~

    it , is b:. :a g e ret~ .

    Z A i?:

    (

    :t l u a r v ; [ I :

    i t ' ~ ~ = ~ e. !. a n t t m h a p p y .i ) () ~ 0 U T i t lN K C O M I N G I I E R E W I L l , I i E L P Y O U N O T T O

    t @ ; i T N i I A P P Yi > c o d s o m e h e l p , t id a l m , , te h s e e m s c e r t a i n ." G ' I~ A T W O L ' I , D I T M E A N T O Y O U I F Y O U G O T S O M E I I E L Pl 'c , ri~ p s I c o u l d l e a r n ~ o g e t a h m g v , i t h m y m o t h e r .2- . f : :LL 2 ~ i i : : M O R E A B O U T Y O U E F A M I L Y) ,[5 " - m n h e r t a k e s c a r e o f m e ,W i I ( ) E I , S E I N 0 U R F A M I L Y T A K E S C A i I E 0 F Y O U) , i y f a t h e r .Y O [ / R F A T H E R5 - ,) u a r e l i k e m y f a t h e r i n s o m e w a y s .W i I A T R E S E M B L A N C E D O Y O U S E EY o u a r e n o t v et' ,, " a g g r e s s i v e b u t 1 t h i n k y o u d o n ' t w a .t~ . t m e t o

    n o t i c e t h a t .W H A T M A K E S Y O U T t tI N K I A M N O T V E R ~ A G G R E S S I V E~ ' o u d o l t ' ; a r g u e w i t h m e .W I l Y 1 )O Y O U T H I N K I D O N ' T A R G U E W I T H Y O U" ~ -( }u a r e a f r a i d o f m e ,D O E S i T P L E A S E Y O U T O B EI , I E \ ' E I A M A F R A [ I ) O F Y O UM y f ar h e r i s a f ra i d o f e v e r y b o d y .W H A T E L S E C O M E S T O M I N D W t I E N Y OU T H I N K O F

    Y ( ) ( - I I F A T H E RB u l l i e s .D O E S T H A T H A \ - E A N Y T t I I N G T O D O W I T H T H E F A C T

    T I tA T Y O U R B O Y F R I E N I ) M A D E Y O U C O M E H E R ET h e c a p i t a l i z e d l i n e s a r e t h e m a c h i n e r e s p o n s e s .

    T h e g r o s s p r o c e d u r e o f t h e p r o g r a m i s q u i t e s i m p l e ; t h et e x t : i s r e a d a n d i n s p e c t e d f o r t h e p r e s e n c e o f a keyword.i f s u c h a w o r d is f o u n d , t h e s e n t e n c e i s t r a n s f o r m e da c c o r d i n g t o a rule a s s o c i a t e d w i t h t h e k e y w o r d , i f n o t ac o n t e n t - f r e e r e n m r k o r , u n d e r c e r ta i n c o n d it i o n s, a n ea r l ie rt r a n s f o r m a t i o n i s r e t ri e v e d . T h e t e x t so c o m p u t e d o rr e t r i e v e d i s t h e n p r i n t e d o u t .

    I n d e t a i l , o f c o u r s e , t h e p r o c e d u r e s k e t c h e d a b o v e i sc o n s i d e r a b l y m o r e c o m p le x . K e y w o r d s , f o r e x a m p l e , a m yh a v e a R A X K o r p r e c ed e n c e n u m b e r . T h e p r o c e d u r e iss e n s i t i v e t o s u c h n u m b e r s i n t h a t i t w i ll a b a n d o n a k e y -w o r d a . l r e a d y f o u n d i n th e l e f t - t o - r i g h t s c a n o f t h e t e x t i nf x v o r o f o n e h a v i n g a h i g h e r r a n k . A l s o , t h e p r o c e d u r er e e o ~ , a f i z e s a c o m m a o r a p e r i o d a s a d e l i m i t e r . W h e n e v e re i t h e r o n e i s e n c o u n t e r e d a n d a k e y w o r d h a s a l r e a d y b e e nf o u n d , a l l s n b s e q u e n t t e x t i s d e l et e d f r o m t h e i n p u t m e s -s a g e . I f n o k e y h a d y e t b e e n f o u n d t h e p h r a s e o r s e n te n c eto t h e l ef t o f t h e d e l i m i t e r ( a s w e l l a s t h e d e l i m i t e r i t s e l f )i s d e l e t e d . A s a r e s u l t , o n ly s i n g le p h ra s e s o r s e n te n c e s a ree v e r t r a n s f o r m e d .

    I e y w o r d s a n d t h e i r a s s o c ia t e d t r a n s f o r m a t i o n t r u l esc o n s t i t u t e t h e S C R I P T f o r a p a r t i c u l a r cl as s o f c o n -v e r s a t i o n . A n i m p o r t a n t p r o p e r t y of E L I Z A is t h a t as c r i p t i s d a t a ; i .e ., i t is n o t p a r t o f t h e p r o g r a m i t s e l f.H e n c e , E L I Z A is n o t r e s t ri c t e d t o a p a r t i c u l a r s e t o fr e c o g n i t i o n p a t t e r n s o r r e s po n s e s, i n d ee d n o t e v e n t o a n ys p e c i f i c l a n g u a g e . E L I Z A s c r i p t s e x is t ( at , t h i s w r i t i n g ) i nW e l s h a t t d G e r n m n a s w e ll a s i n E n gl is h .

    T h e f u n d a m e n t a l t e ch n i ca l p r o bl e m s w it h w h ic h E L I Z Am u s t b e p r e o c c u p i e d a r e t h e f o l l o w i n g :

    ( 1 ) T h e i d e n t i fi c a ti o n o f t h e " m o s t i m p o r t a n t " k e y w o r dT h e w o r d " t r a n s f o r m a t i o n " i s u s e d i n i t s g e n e ri c s e n s e r a th e r

    t h a n t h a t g i v e n i t b y t i a. r ri s a n d C h o m s k y in li n g u i s t i c c o n t e x t s .V ( ~ l u m e 9 / N u m h e r 1 / J a n u a r y , 1 96 6

    o c c u r r i n g i n t h e i n p u t m e s s a g e .( 2 ) T i l e i d e n t i f i c a t i o n o f s o m e m i n i m a l c o n t e x t w i

    w h i c h t h e c h o s e n k e y w o r d a t ) p e a r s ; e . g . , i f t h e k e y w o r"you", i s i t f o l l o w e d b y t h e w o r d " a r e " ( i n w h i c h e a sa s s e r t io n i s p r o b a b l y b e i n g m a d e ) .

    ( 3 ) T h e c h o i c e o f a n a p p r o p r i a t e t r a n s f o r m a t i o n a n d , o f co u r s e , t h e m a k i n g o f th e t r a n s f o r m a t i o n i t s el f

    ( 4 ) T h e p r o v i s io n o f m e c h a n i s m t h a t w i ll p eE L I Z A t o r e s p o n d "intelligently" w h e n t h e i n p u t c o n t a i n e d n o k e y w o r d s .

    ( 5 ) T h e p r o v i s i o n o f m a c h i n e r y t h a t f a c i l i t a t es e di tp a r t i c u l a r l y e x t e n s i o n , o f t h e s c r i p t o n t h e s c r i p t w r il e v e l .

    T h e r e a r e , o f c o u r s e , t h e u s u a l c o n s t r a i n t s d i c t a t e dt h e n e e d t o b e e e o n o n f i c a l i n t h e u s e o f c o m p u t e r t i m e s t o r a g e s p a c e .

    T h e c e n t r a l i s s u e i s c l e a r l y o n e o f t e x t m a n i p u l a ta n d a t t h e h e a r t o f t h a t i s s u e i s t h e c o n c e p t o f t h e trformation rule w h i c h h a s b e e n s a i d t o b e a s s o c i a t e d wc e r t a i n k e y w o r d s . T h e m e e h a n i s i n s s u b s u m e d u n d e r s l og a .n " t r a n s f o r m a t i o n r u l e " a r e a n u m b e r o f S LI P ft i o n s w h i c h s e r v e t o ( 1 ) d e c o m p o s e a d a t a s t r i n g a c c o r dt o c e r t a i n c r i t e r i a, h e n c e t o t e s t t h e s t r i n g a s t o w h e t hs a t i s f i e s t h e s e c r i t e r i a o r n o t , a n d ( 2 ) t o r e a s s e m bd e c o m p o s e d s t r i n g a c c o r d i n g t o c e r t a i n a s s e m b l y sp e cit i o n s .

    Wh i l e t h i s i s n o t t h e i ) l a c e t o d i s c u s s t h e s e fu n c t i o na l l t h e i r d e t a i l ( o r e v e n t o r e v e a l t h e i r f u l l p o w e r g e n e r a l it y ) , i t is i m p o r t a n t t o t h e u n d e r s t a n d i n g o fo p e r a t i o n o f E L I Z A t o d e s c r i b e t h e m i n some d e ta i l .

    C o n s i d e r t h e s e n te n c e " I a n t v e r y u n h a p p y t h e s e d aS u p p o s e a f o r e i g n e r w i t h o n l y a l i m i t e d k n o w l e d g eE n g l i s h b u t w i t h a v e e r g o o d e a r h e a r d t h a t s e n t es p o k e n b u t u n d e r s t o o d o n l y t h e f i rs t t w o w o r d s " I aW i s h i n g t o a p p e a r i n t er e s t ed , p e r h a p s e v e n s y m p a t h eh e m a y r e p l y " H o w l o ng h a v e y o u b e e n v e r y u n h at h e s e d a y s ? " W h a t h e n m s t h a v e d o n e i s t o a p p l y a ko f t e m p l a t e t o t h e o r i g i n a l s e n t e n c e , o n e p a r t o f w hm a t c h e d t h e t w o w o r d s " I a l n " a n d t h e r e m a i n d e r i so lt h e w o r d s " v e r y u n h a t ) p y t h e s e d a y s " . H e m u s t a l s o ha r e a s s e m b l y k i t s p e c if i c a l ly a s s o c i a t e d w i t h t h a t t e m p lo n e t h a t s p e c i f i e s t h a t a n y s e n t e n c e o f t h e f o r m " I B L A H " c a n b e t r a n s fo r m e d t o " H o w l o ng h a v e y o u bB L A H " , i n d e pe n d e n tl y o f t h e m e a n i n g o f B L A H .s o m e w h a t m o r e c o m p l i c a t e d e x a m p l e i s g i v en b y s e n t e n ce " I t s e e m s t h a t y o u h a t e m e " . H e r e t h e fo r eiu n d e r s t a n d s o n l y t h e w o r d s " y o u " a n d " m e " ; i . e . ,a p p l i e s a t e m p l a t e t h a t d e c o m p o s e s t h e s e n t e n c e i n t o f o u r p a r t s :

    ( 1 ) I t s e e m s t h a t ( 2 ) y o u ( 3 ) h a t e ( 4 ) m eo f w h i c h o n l y t h e s e c o n d a n d f o u r t h p a r t s a r e u n d e r s t oT h e r e a s s e m b l y r u l e m i g h t t h e n b e " W h a t m a k e s t h i n k I h a t e y o u " ; i . e . , i t n f i g h t t h r o w a w a y t h e fc o m p o n e n t , t r a n s l a t e t h e t w o k n o w n w o r d s ( " y o u "" I " a n d "me" t o " y o u " ) a n d t a c k o n a s t o c k p h( W h a t m a k e s y o u t h i n k ) t o t h e f r o n t o f th e r e co n s tr u c ti

    C o m m u n i c a t i o n s o f t h e A C M

  • 8/3/2019 Communications of the ACM 1966 Weizenbaum

    3/10

    A f o r m a l n o t a t i o n i n w h i c h t o r e p r e s en t t h e d e c o m p o s i t io nt e m p l a t e i s :

    (0 Y O U 0 M E )a n d t h e r e a s s e m b l y ru l e

    ( W H A T M A K E S Y O U T H I N K I 3 Y O U ) .T h e " 0 " i n th e d e c o m p o s i t i o n r u le s t a n d s f o r " a n in -d e f i ni t e n u m b e r o f w o r d s " ( a n a l o g o u s to t h e i n d e f in i t ed o l l a r s i g n o f C O M I T ) [6 ] w h i l e t h e " 3 " i n t h e r e a s s e m b l yr u le i n d i c a te s t h a t t h e t h i r d c o m p o n e n t o f t h e s u b j e c td e c o m p o s i t i o n i s t o b e i n s e r t e d i n i t s p l a c e . T h e d e c o m -p o s i t i o n r u l e

    ( 0 Y O U 1 M E )w o u l d h a v e w o r k e d j u s t a s w e l l i n t h i s s p e c if i c e x a m p l e . An o n z e r o i n t eg e r " n " a p p e a r i n g i n a d e c o m p o s i t i o n r u l ei n d i c a t e s t h a t t h e c o m p o n e n t i n q u e s t i o n s h o u l d c o n s i s to f e x a c t l y " n " w o r d s . H o w e v e r , o f t h e t w o r u l e s s h o w n ,o n l y t h e f i rs t w o u l d h a v e m a t c h e d t h e s e n t e n c e , " I t s e e m sy o u h a t e a n d l o v e m e , " t h e s e c o n d f ai l in g b e c a u se t h e r e i sm o r e t h a n o n e w o r d b e t w e en " y o u " a n d " m e " .

    ~ 1 R I , 1 R 1 , 2 " ' " R l , m l D 2 R 2 J R Z , Z " " " R z , m 2 D e R a , t F I n '2 ~ " " R % n a n

    F r o . 1 . : K e y w o r d a n d r u le li s t s t r u c t u r ei n E L I Z A t h e q u e s t i o n o f w h i c h d e c o m p o s i t io n r ul es t o

    a p p l y t o a n i n p u t t e x t i s o f c o u r s e a c r u c i a l o n e . T h e i n p u ts e n t e n c e m i g h t h a v e b e e n , f o r e x a m p l e , " I t s e e m s t h a ty o u h a t e , " i n w h i c h e a s e t h e d e c o m p o s i t i o n r u le ( 0 Y O U0 M E ) w o u l d h a v e f a il ed i n t h a t t h e w o r d " M E " w o u l dn o t h a v e b e e n f o u n d a t a l l , l e t a l o n e i n i t s a s s i g n e d p l a c e .S o m e o t h e r d e c o m p o s i t i o n r u le w o u l d t h e n h a v e t o b et r i e d a n d , f a i li n g t h a t , s t il l a n o t h e r u n t i l a m a t c h c o u l db e m a d e o r a t o t a l f ai l u re r ep o r t e d . E L I Z A m u s t t h e r e f m ~h a v e a m e c h a n i s m t o s h a r p l y d e l i m i t t h e s e t o f d e c o m -p o s i t i o n r u l e s w h i c h a r e p o t e n t i a l l y a p p l i c a b l e t o a c u r -r e n t l y a c t i v e i n p u t s e n t e n ce . T h i s i s t h e k e y w o r d m e c h a -n i s m .

    A n i n p u t s e n t e n c e i s s c a n n e d f r o m l e f t t o r i g h t . E a c hw o r d i s l o o k e d u p i n a d i c t i o n a r y o f k e y w o r d s . I f a w o r di s i d e n t i f i e d a s a k e y w o r d , t h e n ( a p a r t f r o m t h e i s s u e o fp r e c e d e n c e o f k e y w o r d s ) o n l y d e c o m p o s i t i o n r u l e s c o n -t a i n i n g t h a t k e y w o r d n e e d to b e t r i ed . T h e t r i a l s e q u e n c ec a n e v e n b e p a r t i a l l y o r d e r e d . F o r e x a m p l e , t h e d e c o m -p o s i t io n r u l e ( 0 Y O U 0 ) a s s o c i at e d w i t h t h e k e y w o r d" Y O U " ( a n d d e c o m p o s i n g a n i n p u t s e n t e n c e i n t o ( 1 ) a l lw o r d s i n f r o n t o f " Y O U " , ( 2) t h e w o r d " Y O U " , a n d ( 3)a l l w o r d s f o l l o w i n g " Y O U " ) s h o u l d b e t h e l a s t , o n e t r i e ds i n c e i t i s b o u n d t o s u c c e e d .

    T w o p r o b l e m s n o w a r i se . O n e s te m s f r o m t h e f a c t t h a t

    a l m o s t n o n e o f t h e w o r d s i n a n y g i v e n s e n t e n c e a r e r e p r e .s e n t e d i n t h e k e y w o r d d i c t i o n a r y . T h e o t h e r i s t h a t o" a s s o c i a t i n g " b o t h d e c o m p o s i t ; i o n a n d r e a s s e m b l y r u l e sw i th ke yw ord~ - ;. T h e i i r s t is s e r i ous i n t h a t t he de te rmi na -t i o n t h a t a w o r d i s n o t i n a d i c t i o n a r y m a y w e l l r e q u i r em o r e c o m p u t a t i o n ( i. e. , t i m e ) t h a n t h e l o c a t i o n o f a wo rdw h i c h i s r e p r e s e n t e d . T h e a t t a c k o n b o t h p r o b l e m s b e g i n sb y p l a c i n g b o t h a k e y w o r d t r o d i ts a s s o c i a t e d r u l e s o n al i s t . T h e b a s i c f o r m a t o f a t y p i c a l k e y l i s t is t h e f ol lo w in g:( K ( ( D 0 ( R ~ . t ) ( R ~ , 2 ) " ' " ( R t .. . ))

    ( (D2) (R2 . ~ ) (R2.2) " " (R2. ,, ,~ ) ):( ( D , ~ ) ( R , , , ~ ) (t a w , ~ ) . . . ( R , ~ , . ~ ) ) )

    w h e r e K i s t h e k e y w o r d , D , t h e i t,h d e c o m p o s i t i o n r u l ea s s o c i a te d w i t h K a n d R, ~ t h e j t h r e a s s e m b l y r u l e a ss 0c i a te d w i t h t h e i t h d e c o m p o s i t io n r u le .

    A c o m m o n p i c t o r ia l r e p r e s e n t a t i o n o f s u c h a s t ru c tu r ei s th e t r e e d i a g r a m s h o w n i n F i g u r e 1 . T h e t o p l e ve l ot h i s s t r u c t u r e c o n t a i n s t h e k e y w o r d f o l lo w e d b y t h e n a m eso f l i st s ; e a c h o n e o f w h i c h i s a g a i n a l i s t s t r u c t u r e b e g in n i n gw i t h a d e c o m p o s i t i o n r u l e a n d f o l lo w e d b y r e a s s em b l yr u l e s . S i n c e l i s t s t r u c t u r e s o f t h i s t y p e h a v e n o p r e d e t e r -m i n e d d i m e n s i o n a l i t y l i m i t a t io n s , a n y n u m b e r o f de co mp o s i t io n r u l e s m a y b e a s s o c i at e d w i t h a g i v e n k e y w o r d a nda n y n u m b e r o f r e a s s e m b l y r u l e s w i t ch a n y s p e c i f ic d ec om -p o s i t i o n r u l e . S L i P i 8 r i c h i n f u n c t i o n s t h a t s e q u e n c e o v es t r u c t u r e s o f th i s t y p e e f f ic i en t l y. H e n c e p r o g r a m m i np r o b l e m s a r e m i n i m i z e d .

    A n E L I Z A s c r i p t c o n s i s t s m a i n l y o f a s e t o f li s t s t ru ct u r e s o f t h e t y p e s h o w n . T h e a c t u a l k e y w o r d d i c t i o n a r y ic o n s t r u c t e d w h e n s u c h a s c r i p t i s f i r s t r e a d i n t o th eh i t h e r t o e m p t y p r o g r a m . T h e b a s i c s t r u c t u r a l c o m p o n e no f t h e k e y w o r d d i c t i o n a r y is a v e c t o r K E Y o f ( c u rr e n tl y )1 2 8 c o n t i g u o u s c o m p u t e r w o r d s . A s a p a r t i c u l a r k e y li ss t r u c t u r e i s r e a d t h e k e y w o r d K a t i t s t o p i s r a n d o m i z e d( h a s h e d ) b y a p r o c e d u r e t h a t p r o d u c e s ( c u r r e n t l y ) a 7b i t i n t e g e r " i " . T h e w o r d " a l w a y s " , f o r e x a m p l e , y i e l d st h e i n t e g e r 1 4 . K E Y ( i ) , i . e . , t h e i t h w o r d o f t h e v e c t o rK E Y , i s t h e n e x a m i n e d t o d e t e r m i n e w h e t h e r i t c o n t ai na l i s t . n a m e . I f i t d o e s n o t , t h e n a n e m p t y l i s t is c r e at e di t s n a m e p l a c e d i n K E Y ( i ) , a n d t h e k e y l i s t s t r u c t u r e i nq u e s t i o n p l a c e d o n t h a t l is t. I f K E Y ( i ) a l r e a d y c o n t a i n s al i s t n a m e , t h e n t h e n a m e o f t h e k e y l i s t s t r u c t u r e i s p l ac e do n t h e b o t t o m o f t h e li s t n a m e d i n K E Y ( i ) . T h e l a rg e sd i c t i o n a r y s o f a r a t t e m p t e d c o n t a i n s a b o u t 5 0 k ey w o r d sN o l is t n a m e d i n a n y o f t h e w o r d s o f t h e K E Y v e c toc o n t a i n s m o r e t h a n t w o k e y l i s t s t r u c t u r e s .

    E v e r y w o r d e n c o u n t e r e d i n t h e s c a n o f a n i n p u t t e x ti .e ., d u r i n g t h e a c t u a l o p e r a t i o n s o f E L I Z A , i s r a n d o m i z e db y t h e s a m e h a s h i n g a l g o r i t h m a s w a s o r i g i n a l l y a p p l ie d tot h e i n c o m i n g k e y w o r d s , h e n c e y i e l d s a n i n t e g e r w h ic hp o i n t s t o t h e o n l y p o s s i b le l is t s t r u c t u r e w h i c h c o u l dp o t e n t i a l l y c o n t a i n t h a t w o r d a s a k e y w o r d . E v e n t h e no n l y t h e t o p s o f a n y k e y l is t s t r u c t u r e s t h a t m a y b e f o u n dt h e r e n e e d b e i n t e r r o g a t e d t o d e t e r m i n e w h e t h e r o r n o t k e y w o r d h a s b e e n f o u n d . B y v i r t u e o f t h e v a r i o u s l i s

    3 8 C o m m u n i c a t i o n s o f t i le A C M V o l u m e 9 / N u m b e r 1 / J a n u a r y , 196

  • 8/3/2019 Communications of the ACM 1966 Weizenbaum

    4/10

    i :

    w o r ds Oi l

    Y V ~ i r t :

    e e t o g

    :::

    :i}

    . . . .,-.~,~,~ciT~o.~.,. . . . . ~ , o p er at io n s_ t h a t SL I P ma k es av a i l ab l e , t h ea , : t t t a ] i d en t i f i ca t i o n o f a k ey wo r d l eav es a s i t s i ) r i m: i p a lp r o d u c t a p o i n t e r t o t h e l i s t o f d e c o m p o s i t i o n ( a n d h e n c er c : t ~ s e ~ b l y ) r u l e s a s s o c i a te d w i t h t h e i d e n t i f ie d k e y w o r d .( ) ~e r e s ui ~ o f t h i s s t r a t eg y i s t h a t o f t en l es s t i me i s r eq u i r edt o d i s co v er t h a t a g i v en wo r d i s >_ o f i n t h e k ey w o r d d i c -~ i o ~ar y t h an t o l o ca t e i t i f it. i s th e r e . H o w ev er , t i l e l o ca t i o no f a k e y w o r d y i e l d s p o i n t e r s t o a l l in f o r n t a t i o n a s s o c i a te dw i t h t h a t w o r d .S o m e c o n v e r s a t i o n a l p r o t o c o l s r e q u i r e t h a t c e r t a i nt r a n s f o r m a t i o n s b e m a d e o n c e r t a i n w o r d s o f .th e in p u t t e x ti i i d e p e n d e l ~ t l y o f a n y c o n t e x t u a l c o n s i d e r a t i o n s . T h e f i r s tc o n v e r s a t i o n d i s p l a y e d i n t h i s p a p e r , f o r e x a m p l e , r e q u i r e st h a t f ir sb p e r s o n p r o n o u n s b e e x c h a n g e d f o r s e c o n d p e rs o np r o n o u n s a n d v i c e v e r s a t h r o u g h o u t t i le i n p u t t e x t . T h e r em a y b e f u r t h e r t r a n s fo r m a t i o n s b u t t h e se m i n im a l s u b-s t i t u t i o n s a r e u n c o n d i t i o n a l . S i m p l e s u b s t i t u t i o n r u l e so u g h t n o t t o b e e l e v a t e d t o t h e l e v e l o f t r a n s f o r m a t i o n s ,n o r s h o u l d t h e w o r d s i n v o l v e d b e f o r c e d t o c a r r y w i t h t h e ma l l t h e s t r u c t u r e r e q u i r e d f o r t h e f u l l y c o m p l e x c a s e .] , ' u r t h e r m o r e , u n c o n d i t i o n a l s u b s t i t u t i o n s o f s i n g l e w o r d sf o r s i n g l e w o r d s c a n b e a c c o m p l i s h e d d u r i n g t h e t e x t s c a ni t s e l f, n o t a s a L r an s f o r mat . i o n o f t h e en t i r e t ex t s u b s e q u en tt o s c a n n i n g . T o f a c i l i t a t e t h e r e a l i z a t i o n o f t h e s ed e s i d e r a t a , a n y w o r d i n t h e k e y d i c t i o n a r y , i . e . , a t t h et o p o f a k ey f is t, s t r u c tu r e . , ma y b e f o l l o wed b y an eq u Ms i g n f o l l o w e d b y w h a t e v e r w o r d i s t o b e i t s s u b s t i t u t e .T r a n f o r m a t i o n r u l e s m a y , b u t n e e d n o t , f o l l o w . I f n o n ed o f o l l o w s u ch a s u b st , i t u t i o n r u l e , t h en t h e s u b s t i t u t i o n i smad e o n t h e f l y , i . e : , d u r i n g t ex t s can n i n g , b u t t h e wo r di n q u e s t i o n i s n o t i d e n t i fi e d a s a k e y w o r d f o r s u b s e q u e n tp u r p o s e s . O f c o u r s e , a w o r d m a y b e b o t h s u b t i t u t e d f o ra n d b e a k e y w o r d a s w e l l . A n e x a m p l e o f a s i m p l e s u b -s t i t u t i o n i s

    (YOUIISELF = MYSELF) .N e i t h e r " y o u r s e l f " n o r " m y s e l f " a re k e y w o r d s i n th ep a r t i c u l a r s c r i p t f r o m w h i c h t h i s e x a m p l e w a s c h o s e n .

    T h e f a c t t h a t k e y w o r d s c a n h a v e r a n k s o r p r e c e d e n c e sh a s a l r e a d y b e e n m e n t i o n e d . T h e n e e d o f a r a n k in g m e c h a -n i s m m a y b e e s t a b l i s h e d b y a n e x a m p l e . S u p p o s e a n i n p u ts e n t e n c e is " I k n o w e v e r y b o d y la u g h e d a t m e . " A s c r i p tm a y t a g t h e w o r d " I " a s w e l l a s t h e w o r d " c v e t T b o d y "a s a k e y w o r d . W i t h o u t d i f f e r e n ti a l r a n k i n g , " I " o c c u r r i n gf i r s t w o u l d d e t e r m i n e t h e t r a n s f o r m a t i o n t o b e a p p l i e d .A t y p i c a l r e s p o n se m i g h t b e " Y o u s a y y o u k n o w e v e r y b o d yl a u g h e d a t. y o u . " B u t . t h e i m p o r t a n t m e s s a g e i n t h e i n p u ts e n t e n c e b e g in s w i t h t h e w o r d " e v e r y b o d y " . I t i s v e r yo f t e n t r u e t h a t w h e n a p e r s o n s p e a k s i n t e r m s o f u n i v e r s a lss u c h a s " e v e r y b o d y " , " a l w a y s " a n d " n o b o d y " h e i s r e a l l yr e f e r r i n g to s o m e q u i t e s p e c i fi c e v e n t o r p e r s o n . B y g i v i n g" ' e v e r y b o d y " a h i g h e r ra n k t h a n " I " , t h e r e s p o n s e " W h oi n p a r t ic u l a r a r e y o u t h i n k i n g o f " m a y b e g e n e r at e d .

    T h e s p ec i fi c m e c h a n i sm e m p l o y e d i n r a n k i n g i s t h a t t h er a n k o f e v e r y k e y w o r d e n c o u n t e r e d ( a b s e n c e o f r a n ki m p l i e s r a n k e q u a l s 0 ) i s c o m p a r e d w i t h t h e r a n k o f th eh i gh e s t, r a n k e d k e y w o r d a l r e a d y s e e n . I f t h e r a n k o f t h eV o l u m e 9 / N u m b e r 1 / .] a n u a r y , 1 966

    n e w w o r d is h i g h e r t h a n t h a t o f a n y p r e v i o u s ly et e r e d w o r d , t h e p o i n t e r t o t il e t r a n s f o r m a t i o na s s o c i a te d w i t h t h e n e w w o r d i s p l a c e d o n t o p o fc a ll e d t h e k e y s t a c k , o t h e r w i s e i t i s p l a ce d o n t h e bo f t h e k e y s t ae k . W i ze n t h e t e x t s c a n te r m i n a t e s, t hs t a c k h a s a t i t s t o p a p o i n t e r a s s o c i a t e d w i t h t h e hr a n k e d k e y w o r d e n c o u n t e r e d i n th e sc a n. T h e r e mp o i n t er s i n t h e s ta c k m a y n o t b e m o n o t o n i c a l l y ow i t h r e s pe c t to t h e r a n k s o f t h e w o r d s f r o m w h i cw e r e d e r iv e d , b u t t h e y a r e n e a r l y s o - - i n a n y e v e na r e i n a u s e f u l a t t d i n t e r e s t i n g o r d e r . F i g u r e 2 i s a s

    ,~ k e ' / s t e c k ~ J

    ' ' ' * ! : YES- ~ . . .. . . ~. ._ i k. . ! i_ IH~[_ /~- -_

    Y gS

    t ~' ~c___F -]:;,:~:o~ 1FIG. 2 . Ba s ic f low d i ag ra m of keyword detect .ion

    f le d f lo w d i a g ra m o f k e y w o r d d e t e c ti o n . T h e r a n kk e y w o r d m u s t , o f c o u r s e , a ! s o b e a s s o c i a te d w i tk e y w o r d . T h e r e f o r e i t m u s t a p p e a r o n th e k e y w os t r u c t u r e . I t m a y b e f o u n d , i f a t a l l, j u s t i n f r o n t l is t o f t r a n s f o r m a t i o n r u l e s a s s o c i a t e d w i t h t h e k e yA s a n e x a m p le c o n s i d e r t h e w o r d " M Y " i n a p a r ts c r i p t. I t s k e y w o r d l is t m a y b e a s f o ll o w s :

    (MY - - YOUR. 5 ( t ra nsf orm at io n ru les) ).S u c h a l is t w o u ld m e a n t h a t w h e n e v e r th e w o r d " Me n c o u n t e r e d in a n y t e x t , i t w o u l d b e r ep l a c ed b y t h e" Y O U R " . I ts ra n k w o u l d b e 5 .

    U p o n c o m p l e t io n of a g i v e n t e x t sc a n, t h e k e y s te i t h e r e m p t y o r c o n t a i n s p o i n t e r s d e r i v e d f r o m t h ew o r d s f o u n d in th e t e x t . E a c h o f s u c h p o i n t e r s i s a c t us e q u e nc e r e a d e r - - a S L i p m e c h a n i s m w h i c h fa c is c a n n i n g o f l i s t s - - p o i n t i n g i n t o i ts p a r t i c u l a r k e y s u c h a w a y t h a t o n e s e q u e n c i n g o p e r a t i o n t o t h e ( S E Q L R ) w i ll s e q u e n c e i t t o t h e f i rs t s e t o f t r a n s f o r mr u l e s a s s o c i a te d w i t h i t s k e y w o r d , i .e . , t o t h e l is t

    ( (Dr ) (Rt , , ) (R , , e ) . . . (R~,R, .~) ) .T h e t o p o f t h a t l i s t , o f co u r s e , i s a l i s t wh i ch s e rd e c o m p o s i ti o n r u le f o r t h e s u b j e c t t e x t. T h e t o p ok e y s t a c k c o n t a i n s t h e f i r s t , p o i n t e r t o b e a c t i v a t e d .

    T h e d e c o m p o s i ti o n r u l e D ~ a s s o ci a te d w i t h t h e k e yK , i .e ., { ( D 0 , K } , i s n o w t r i e d . I t m a y f a i l h o w e v ee x a m p l e , s u pp o s e t h e i n p u t t e x t w a s :

    Yo u a r e v e r y h e l pf ul .C o n a r n u n i c a t i o n s o f t h e A C M

  • 8/3/2019 Communications of the ACM 1966 Weizenbaum

    5/10

    T i le lw y w o r< t , s a y , i s " ' y o u " , a n d I c D , ) , y o u } i s(0 I remind you of 0;.

    ( l- h :c a ll t h a t t h e " y o u " i t, t h e o r i g i n a l s e n t e n c e h a s a l r e a d yb ( : ( n r e p l a c e d I %" " I " i n t h e t e x t n o w a n a l y z e d . ) T h i sd e t : o m p o s i l i c q ~ r u l e o b v i o u s l y f a i l s t o m a t c h t i l e i n p u ts e n t e n c e . S h o u l d i ( D 0 , K } f a i l t o f i n d a m a t c h , t h e nI ( D 2 ) , K } i s t r i e d . S h o u ld t h a t t o o f a i l, { ( D a ), K } i sa t l e m p t e d , a n d s o ( m. O f c o u rs e , l h e s et o f t r a n s f o r m a t i o nr u l es c a n b e g u a r a n t e e d t o t e r m i n a t e w i t h a d e c o m p o s i t i o nr u l e w h i c h n m s t m a t c h . T h e d e c o m p o s i t i o n r u l e

    (oKo)w i ll m a t c h a n y t e x t i n w h i c h ti le w o r d K a p p e a r s w h i l e

    (0)w i ll m a t c h a n y t e x t w h a i e v e r . H o w e v e r , t h e r e a re o t h e rw a y s t o l e a v e a p a r t i c u l a r s e t o f t r a n s f o r m a t i o n r u l e s , a sw i ll b e s h o w n b e l o w . F o r t h e p r e s e n t , s u p p o s e t h a t s o m ep a r t i c u l a r d e c o m p o s i t i o n r u l e (D,') h a s l n a t e h e d t h e i n p u tt e x t . ( D ~ ) , o f c o u r s e , w a s fo u n d o n a l i s t o f t h e f o r m

    ((DO(R:, ~ ) ( & ~ ) - - - (R, - . .. . ) ) .S e q u e n c i n g t h e r e a d e r w h i c h i s p r e s e n t l y p o i n t i n g a t( D , ) w i l l r e t r i e v e t h e r e a s s e m b l y r u l e ( R , . ~ ) w h i c h m a yt h e n b e a p p l i e d t o t h e d e c o m p o s e d i n p u t t e x t t o y i e l d t h eo u t p u t m e s s a g e .

    C o n s i d e r a g a i n t h e i n p u t t e x tYou are very helpful.:..

    i n w h i c h "you" i s t h e o n l y k e y w o r d . T h e s e n t e n c e i st r a n s f o r m e d d u r i n g s c a n n i n g t o

    [ are very hell)ful( D r ) , y o u } i s "(0 i r e m i n d y o u r o f 0 ) " a n d f a il s t o m a t c h

    a s a l r e a d y d i s c u s s e d . H o w e v e r , I ( D e ), y o u } i s " ( 0 I a r e 0 ) "a n d o b v i o u s l y m a . t e h e s t h e t e x t , d e c o m p o s i n g i t in t o t h ec o l t s t i t u e n t s

    d) em pt y (2) I .,.3) are 6l) ve ry helpful.{(Re . I ) , you} i s

    (What makes you th ink I am 4)H e n c e i t p r o d u c e s t h e o u t p u t t e x t

    wtm~ makes you th ink I am very he lp fu l .H a v i n g p r o d u c e d i t , t h e i n t e g e r 1 i s p u t i n f r o n t o f (R e . t )s o t h a t t h e i r a n s f o n n a t i o n r u le l is t in q u e s t i o n n o w a p p e a r sa s

    ((D~)I(Re,~)(R2,~) . . . ( R e . . . . . ) ) .N e x t t i m e ~ De ), K } m a t c h e s a n i n p u t t e x t , th e r e a s s e m b l yru le ( R 2 .. 2) w i l l b e a p p l i e d a n d th e i n t e g e r 2 w i l l r e p la c eth e 1 . A f t e r ( R 2 . , ~ , ) h a s b e e n e x e rc i s e d , ( R e. , ) w i l l a g a i nb e i n v o k e d . T h u s , a f t e r t h e s y s t e m h a s b e e n i n u s e f o r at i m e , e x ' e r y d e c o m p o s i t i o n r u l e w h i c h h a s m a t c h e d s o m ei n p u t t e x t h a s a s s o c i a t e d w i t h i t a n i n t e g e r w h i c h c o r r e -s p o n d s t o t h e l as t l ~ a s s e m b l y r u l e u s e d in c o n n e c t i o n w i t h

    t h t G d e c o m p o s i t i o n r u l e. T l , J s m e c h a n i s m h ~ s t ,r e s t h a t t h ec o m p l e t e s e t o f r e a s s e r n b l y r u l e s ~ s s o e i a t e d w i t h a g i v e nd e e o m p o s h : i o n r u l e i s c y c l e d t h r o u g h b e f o r e a n y r e p e t i t i o n s0CCUY,

    T h e s y s t e m d e s c r i b e d s o f a r i s e s s ( q l t i a l l y o n e w h i c hs e l e c ts ~ t d e c o m p o s i t i o n r u l e f o r t h e h i g h e s t r a n k i n g k e y -w o r d f o u n d i n a n i n p u t t e x t , a t t e m p t s t o m a t c h t h a t t e x ta c c o r d i n g t o t h a t d e c o m p o s i t i o n r u l e a n d , f a i l i n g t o m a k ea m a t c h , s e l e c t s t he n e x t r e a s s e m b l y r u le a s s o c i a t e d w i tht h e m a t c h i n g d e c o m p o s i t i o n r u l e a n d a p p l i e s it. t o g e n e r a t ea n o u t p u t t e x i . I t i s , i n o t h e r w o r d s , a s y s t e m w h i c h , f o rt h e h i g h e s t r a n k i n g k e y w o r d o f a t e x t , s e l e c t a a s p e e i f i ed e c o m p o s i t i o n a n d r e a s s e m b l y r u l e t o b e u s e d i l l f o r m i n gt h e o u t p u t m e s s a g e .

    W e r e t h e s y s t e m t o r e m a i n t h a t s i m p l e , t h e n k e y w o r d st h a t r e q u i r e d i d e n t i c a l s e t s o f t r a n s f o r m a t i o n r u l e s w o u l de a c h r e q u ir e t h a t a c o p y o f t h e s e t r a n s f o r m a t i o n r u l e s b ea s s o c i a t e d w i t h t h e m . T h i s w o u k l b e l o g i c a l l y s o u n d b u tw o u l d c o m p l i c a t e t h e t a s k o f s c r i p t w r i t i n g a n d w o u l d a ls om a k e u n n e c e s s a r y s t o r a g e d e m a n d s . T h e r e a r e t h e r e f o r es p e c ia l t y p e s o f d e c o m p o s i t i o n a n d a s s e m b l y r u l e s c h a r -a e t e r i z e d b y t h e a p p e a r a n c e o f . . . . . a t t h e t o p o f t h er u l e l i s t . T h e w o r d f o l l o w i n g t h e e q u a l s i g n i n d i c a t e s w h i c hn e w s e t o f t r a n s f o r m a t i o n r u l e s is t o b e a p p l i e d . ] " o r e x -a m p l e , t h e k e y w o r d " w h a t " m a y h a v e a s s o c i a t e d w i t h i ta t r a n s f o r m a t i o n r u l e s e t o f t h e f o r m

    ((0) (Why do you ask) ( I s tha t an importan t , ques t ion) . . . )w h i c h w o u l d a p p l y e q u a l l y w e l l t o t h e k e y w o r d s " h o w "a n d " w h e n " . T h e e n t ir e k e y w o r d li st f o r " h o w " m a yt h e r e f o r e b e

    ( H o w ( =Wh a t ) )T h e k ey w o r d s " h o w " , " w h a t " a n d " w h e n " m a y t h u s b em a d e t o f o r m a n e q u i v a l e n c e c l a s s w i t h r e s p e c t t o t h et r a n s f o r m a t i o n r u l e s w h i c h a r e t o a p p l y to t h e m .

    I n t h e a b o v e e x a m p l e t h e r u l e " ( = w h a t , ) " i s i n th ep l a c e o f a d e c o m p o s i t i o n r u l e , a l t h o u g h i t c a u s e s n od e c o m p o s i t i o n o f t i l e r e l e v a n t t e x t . I t m a y a l s o a p p e a r ,h o w e v e r , i n t h e p l a c e o f a r e a s s e m b l y r u l e. l . ' o r e x a m p l e ,t h e k e y w o r d "am" m a y h a v e m n o n g o t h e r s t h e f o l l o w i n gt r a n s f o r m a t i o n r u l e s e t a s s o c i a t e d w i t h i t :

    ((0 are you 0) d)o you believe you are 4) . . . ( = w h a t ) . . .) {( i t i s h e r e a s s u m e d t h a t " a r e " h a s b e e n s u b s t i t u t e d f o r" a m " a n d "you" f o r "I " i n t h e i n i t i a l t e x t s e a m ) T h e n ,t h e i n p u t t e x t

    Am I siekw o u l d e l i c i t e i t h e r

    ])o yo u be l ieve you a re s ieko r

    W h y d o y o tl a s k id e p e n d i n g o n h o w m a n y t i n l e s t h e g e n e r a l f o r m h a da l r e a d y o c c u r r e d .

    U n d e r s t i l l o t h e r c o n d i t i o n s i t m a y b e d e s i r a b l e t o4 0 C o n n n u n i c a t i o n s o f t i l e A kC ~I V o l u m e 9 / N u m b e r 1 / J a n u a r y , 1 96 6

  • 8/3/2019 Communications of the ACM 1966 Weizenbaum

    6/10

    < ~ - - ~

    hich

    makewith

    for

    als0

    :

    . , )"

    beth e

    eno

    .)o r

    : i

    :i . c e o f " I ' m " , t h e w o r d " I ' m " i t s e l f , a n d a l l t e x tf o l lo w i ~ l g t il e f ir s t o c c u r r c : w e o f " I ' m " .

    ( 3 ) T h e r e a s s e m b l y r u l e b e g i n n i n g w i t h i h ( ' e o d e' g ? R I 5 " i s e n e o u n t e r e d a t !d t h e d e c o m p o s e d t e xk : r e -a s s e m b l e d s u c h t h a t t h e w o r d s ' I A -X l" a p p e a r i n f r o n to f t h e t h i r d c o n s t i t u e n t , d e t e r m i n e d b y t h e ea r l i e r d e -c o m p o s i t i o u .

    ( 4 ) C o n t x o l i s t r a n s f e r r e d , s o t o s p e a k , to t h e t r a n s -f o r m m i o n r u l e s a s s o c i a t e d w i t h t h e k e y w o r d " y o u " ,w h e r e , f u r t h e r d e c o m p o s i t i o n s e t c . a r e a t t e m p t e d .

    I t , i s t o b e n o t e d t h a t t h e s e t, 'P {Ill (I AM 3) (=Y OU ))

    i~ l o g i c a l l y in t h e p l a c e o f a r e a s s e m b l y r u l e a tt d m a yt h e r e f o r e b e o n e o f r e a l l y r e a s s e m b l y r u l e s a s s o c i a t e d w i t ht h e g i v e n d e co m p o s i t i o n .

    A n o t h e r f o r m o f r e a s s e m b l y r u l e is(NEWKI: :Y)

    v . . , d e h s e r v e s t h e ea s{~ i n w h i c h a t t e m p t s t o n m t c h o n t h e( : u r c e n t l y r e g n a n t k e y w o r d are t o b e g i v e n u p a n d t h ee n d . i r e d e c o m p o s i t i o n a ~ d r e a s s e m b l y p r o c e s s i s t o s t a r ta ~ a h t o n t h e b a s i s o f t h e k e y w o r d t o b e f o u n d i n t h ek e y s t a c k . W h e n e v e r t h is ru l e i s i n v o k e d , t h e t o p o f t t l ek ( ' y s t a ( ' k i s " p o p p e d U l ) " o n c e , i . e . , t h e n e w re g n a n t k e y -w o r d r e c o v e r e d a n d r e m o v e d f r o m t h e k e y s t a c k , at t( .l t h ee n t i r e p r o c e s s r e i n i t i a t e d a s i f t h e i n i t i a l t e x t s c a n h a d j u s l at e r m i r m t e d . T h i s m e c h a n i s m m a k e s i t p o s s ib l e t o , i n e ff e c t,t e s t o n k e y p h r a s e s a s o p p o s e d t o s i n g l e k e y w o r d s .

    A s e r i o u s p r o b l e m w h i e h r e m a i n s t o b e d i s c u s s ed i s t h er e a c t i o n o f t h e s y s t e m i n e a s e n o k e y w o r d s r e n m i n t os e r v e a s t r a n s f o r m a t i o n t r i g g er s . T h i s c a n a r is e e i t h e r i nc a s : , t h e k e3 " st ac k i s e m I ) t y w h e n N E W K E Y i s i n v o k e d o rw h e u t h e i n p u t t e x t . c o n t a i n e d n o k e y w o r d s i n i t i a l l y

    T h e s i m p l e s t m e e l m n i s m s u p p l i e d i s i n th e f o r m o f t h es p e c i a l r e s e rv e d k e y w o r d " N O N E " w h i c h m u s t b e p a r t o fn n y s c r i p t. T h e s c r i p t w r i t e r m u s t a s s o e i at e th e u n i v e r s a l l ym a t c h i n g d e e o m p o s i t i o n r u le ( 0 ) w i t h i t a n d f o l lo w t h i s b ya s m a n y c o n t en t - h 'e e r e m a r k s i n t h e f o r m o f t r a n s f o r m a -t i e d r u l e s a s h e p l e a s e s . ( E x m n p l e s a r e : " P l e a s e g o o n " ,

    r h a r s v e r y i n t er e s t in g " a n d " I s e e" .)T h e r e i s , h o w e v e r , a n o t h e r m e c h a n i s m w h i c h c a u s e s t h e

    s y s t e m t o r e s p o n d m o r e s p e c t a c u l a r l y i n t h e a b s e n c e o f ak e y . T h e w o r d " M E M O R Y " i s a n o t h e r r e se r ve d p s e u do -k e y w o r d . T h e k e y l is t s t r u c t u r e a s s o c i a te d w i t h i t d if f er s

    " V o l u m e 9 / N u m b e r 1 / J a n u a r y , 1 966

    f r o m t h e o r d i n a r y o n e i n s o m e r e s p ec t s . A n e x a mi l I u m i n a t : e s t h i s p o i n t .

    C o n s i d e r t i l e f o l l o w i n g s t r u c t u r e :( M E M O R Y M Y

    (0 Y O U R 0 = L E T S D I S CU S S F U R T H E R W H Y Y O U( 0 Y O U R 0 - E A R L I E R Y O U S A I D Y O U R 3)

    T h e w o r d " M Y " ( w h i c h m u s t b e a n o r d i n a r y k e y wa s w e l l ) h a s b e e n s e l e c t e d t o s e r v e a s p e c i a l f u n c tW h e n e v e r i t is th e h i g h e st r a n k i n g k e y w o r d o f a t e x to f t h e t r a n s f o r m a t i o n s o n t h e M E M O R Y l is t is r a n d os e l e c t e d , a n d a c o p y o f t h e t e x t i s t r a n s f o r m e d a c c o r di nT h i s t r a n s f o r m a t i o n i s s t o r e d o n a f i r s t- i n - fi r s t- o u t sf o r l a t e r u s e . T h e o r d i n a r y p r o c e s s es a l r e a d y d e s c r ib e dt h e n c a r r i e d o u t . W h e n a t e x t w i t h o u t k e y w o r d s isc o u n t e r e d l a t e r a n d a c e rt a i n c o u n t i n g m e c h a n i s m i s p a r t i c u l a r s t a t e a n d t h e s t a c k i n q u e s ti o n i s n o t e mt h e n t h e t r a n s f o r m e d t e x t i s p r i n t e d o u t a s t h e r e p l yi s , o f c o u r s e , a l s o d e le t e d f r o m t h e s t a c k o f s u c h t rf o r m a t i o n s .

    T h e e u r r e n t v e rs i o n o f E L I Z A r e q u ir e s t h a t o n e k e y wb e a s s o c i a t e d w i t h M E M O R Y a n d t h a t e xa c t ly t r a n s f o r m a t i o n s a c e o i n p a n y t h a t w o r d in t h a t c o n t e x t . a p p l i c a t i o n o f a t r a n s f o r m a t i o n r u l e o f t h e f o r m

    ( L E F T H A N D S I D E = t lI G I I T H A N D S I D E )i s e q u i v a l e n t t o t h e s u c ce s s iv e a p p l i c a t io n o f t h e t w o f o

    ( L E F T H A N D S I D E ) , ( R I G I I T H A N D S I D E ) . )T h r e e m o r e d e t a i l s w i ll c o m p l e t e t h e f o r m a l d e s c r ip

    o f t h e E L I Z A p r o g r a m .T h e t r a n s f o r m a t i o n r u l e m e c h a n i s m o f S LI P i s s u c h

    i t p e r m i t s t a g g i n g o f w o r d s in a t e x t a n d t h e i r s u b s e q ur e c o v e r y o n t h e b a s i s o f o n e o f t h e i r t a g s . T h e k e y w" M O T H E R ? ' in E L I Z A , f o r e x a m p le , m a y b e i de nt ia s a n o u n a n d a s a m e m b e r o f t h e c l a ss " f a m i l y " a s f o ll

    ( M O T H E R D L I S T ( /N O U N F A M I L Y ) ) .S u c h t a g g i n g i n n o w a y i n t e r fe r e s w i t h o t h e r i n f o r m a( e .g . , r a n k o r t r a n s f o r m a t i o n r u le s ) w h i c h m a y b e ad a t e d w i t h t h e g i v e n t a g w o r d . A d e c o m p o s i t i o n r u le c o n t a i n a m a t c h i n g c o n s t it u e n t o f t h e f o rm ( / T AT A G 2 . - - ) w h i c h w il l m a t c h a n d i s o la t e a w o r d in s u b j e c t t e x t h a v i n g a n y o n e o f t h e m e n t i o n e d t a gs . Ife x a m p l e , " M O T H E R " i s t a g g e d as i n d ic a te d a n d i n p u t t e x t

    " C O N S I D E R 5 IY A G E D M O T t I E R A S W E L L A S M Es u b j e c t e d t o t h e d e c o m p o s i t i o n ru l e( 0 Y O U R , 0 ( / F A M I L Y ) 0 )( r e m e m b e r i n g t h a t " M Y " h a s b e en re p la c ed b y " Y O U Rt h e n t h e d e c o m p o s i t i o n w o u l d b e

    (1 ) C O N S I D E R (2 ) Y O U R (3) A G E D (4 ) M O T H(5 ) A S W E L L A S M E .A n o t h e r f l e x ib i l it y i n h e r e n t in t h e S L i P t e x t m a n i p

    t i o n m e c h a n i s m u n d er l y in g E L I Z A is t h a o r - in gm a t c h i n g c r i t e r i a i s p e r m i t t e d i n d e c o m p o s i t i o n r uT h e a b o v e i n p u t t e x t w o u l d h a v e b e e n d e c o m p o

    C o m m u n i c a t i o n s o f t h e A C M

  • 8/3/2019 Communications of the ACM 1966 Weizenbaum

    7/10

    :t

    : :::4ffs"

    S

    p r e c i s e l y a s s t a t e d a b o v e b y t h e d e c o m p o s i t i o n r u l e :(0 Y O U R 0 ( . F A T H E I I M O T I I E I I ) 0)

    w h i c h , b y v i r t u e o f t h e p r e s e n c e o f " , " i n t h e s ub l is s t r u c . t u r e s e e n a b o v e , w o u l d h a v e i s o l a t e d e i t h e r t h e w o r d" F A T I t E R " o r " M O T H E R " ( in t h a t o rd e r) in t h e in pu t.t e x t , w h i c h e v e r o c c u r r e d f ir s t a ft e r t h e f i r s t a p p e a r a n c e o ft h e wo rd " Y O U R " .

    F i n a l l y , t h e s c r i p t w r i t e r n m s t b e g i n h is s c r i p t w i t h al i s t, i .e ., a m e s s a g e e n c l o s e d i n p a r e n t h e s e s , w h i c h c o n t a i n st h e s t a t e m e n t h e w is h es E I . I Z A t o t y p e w h e n t h e s y s t e mi s f i r s t l o a d e d . T h i s l i s t n m y b e e m p t y .

    E d i t i n g o f a n E L I Z A s c r i p t is a ch i e v e d v i a a p p e a l t o ac o n t e x t u a l e d i t i n g p r o g r a m ( E D ) w h i c h is p a r t o f t h eM A C l i b r a r y . T h i s p r o g r a m i s c a l l e d w h e n e v e r t h e i n p u tt e x t t o E L I Z A c o n si st s of t h e s in g le w o r d " E D I T " .E H Z A t h e n p u t s i ts e lf i n a s o - c al l ed d o r m a n t s t a t e a n dp r e s e n t s t h e t h e n s t o r e d s c r i p t f o r e d i t i n g . D e t a i l e dd : - s cr i p ti o : t o f E D i s o u t o f p l a ce h e r e . S u f t ic e i t t o s a y t h a tc h a n g e s , a d d i ti o n s a n d d e l e t i o ns o f t h e s c r i p t m a y b e m a d ew i t h c o n s i d e r a b l e e f f i ci e n c y a n d o n t h e b a s i s o f e n t i r e l yc o n t e x t u a l c u e s , i . e . , w i t h o u t r e s o r t t o l i n e n u m b e r s o ra n y o t h e r a r t i f i c i a l d e v i c e s . W h e n e d i t i n g i s c o m p l e t e d ,E D i s g i v e n t h e c o m m a n d t o F I L E t h e r ev i s e d s c r ip t . T h en e w s c r i p t is t h e n s t o r e d o n t h e d i s k a n d r e a d i n t o E L I Z A .E L I Z A l h e n ty p e s t h e w o r d " S T A R T " t o s i gn a l t h a t t h ec o n v e r s a t i o n m a y r e s u m e u n d e r c o n t r o l o f t h e n e w s c r i p t.

    A n i m p o r t a n t c o n s e q u e n c e o f t h e e d i t i n g f a c i l i t y b u i l ti n t o E L I Z A i s t h a t a g i v e n E L I Z A s c r i p t n e e d n o t s t a r to u t t o b e a l a r g e , f u l l - b l o w n s c e n a ri o . O n t h e c o n t r a r y , i ts h o u l d b e g i n a s a q u it e m o d e s t s e t o f k e y w o r d s a n dt r a n s f o r m a t i o n r u l e s a n d p e r m i t t e d t o b e g r o w n a n dm o l d e d a s e x p e r i e n c e w i t h i t b u i l d s u p . T h i s a p p e a r s t ob e t h e b e st . w a y t o u s e a t r ul y , i n t e r a c t i v e m a n - m a c h i n ef a c i l i t y - - i . e . , n o t a s a d e v i c e fo r r a p i d l y d e b u g g i n g a c o d er e p r e s e n t i n g a f u l l y th o u g h t o u t s o l u t i o n t o a p r o b l e m , b u tr a t h e r a s a n a i d f o r th e e x p l o r a t i o n o f p r o b l e m s o l v i n gstrategies.D i s c u s s i o n

    A t t h i s w r i t i n g , t h e o n l y s e r i o u s E L I Z A s c r i p t s w h i e he x i s t a r e s e i n e w h i c h c a u s e E L I Z A t o r e s p o n d r o u g h l y a sw o u l d c e r t a i n p s y c h o t h e r a p i s t s ( R o g e r i a n s ). E L I Z Ap e r f o r m s b e s t w h e n i t s h u m a n c o r r e s p o n d e n t i s i l f i t i a l l yi n s t r u c t e d t o " t a J k " t o i t , v i a th e t y p e w r i t e r o f co u r s e,j u s t a s o n e w o u l d t o a p s y c h i a t r i s t . T h i s m o d e o f t o n -v e r s a t i o n w a s c h o s e n b e c a u s e t h e p s y c h i a t r i c i n t e r v i e wi s o n e o f t h e f e w e x a m p l e s o f c a t e g o r i z e d d y a d i c n a t u r a ll a n g u a g e c o m n m n i e a t i o n i n w h i c h o n e o f t h e p a r t i c i p a t i n gp a i r i s f r ee t o a s s u m e t h e p o s e o f k n o w i n g a l m o s t n o t h i n go f t h e r e a l w o r l d . I f , f o r e x a l n p l e , o n e w e r e t o t e l l a p s v -e h i a t r is t " I w e n t f o r a l o n g b o a t r i d e " a n d h e r e s p o n d e d" T e l l m e a b o u t b o a t s " , o n e w o u l d n o t a s s u m e t h a t h e k n e wn o t h i n g a b o u t b o a t s , b u t t h a t h e h a d s o m e p u r p o s e in sod i r e e ti n g t h e s u b s e q u e n t c o n v e r s a t i o n . I t i s i m p o r t a n t t on o t e t h a t t h i s a s s u m p t i o n i s o n e m a d e b y t h e s p e a k e r.W h e t h e r i t i s r e a l i s t i c o r n o t i s a r t a l t o g e t h e r s e p a r a t eq u e s t i o n . I n a n y c a s e, i t h a s a c r u c i al p s y c h o l o g i c a l u t i l i t y4 2 C o m m u n i c a t i o n s o f t h e A C M

    i>

  • 8/3/2019 Communications of the ACM 1966 Weizenbaum

    8/10

    t gi s,yC -[I :

    wi-~e

    [ e) fi s :

    i t =) f1..11l -

    [e7t

    r

    t

    7

    :ample, the tran>formation rules which cause ihc input

    Everybody hates meto be transformed to

    Can you think of anyone in particularand other such are based on quite specific hypotheses aboutthe world. The whole script constitutes, in a loose way, amodel of certain aspects of the world. The act of writing ascript is a kind of programming act and has all the advan-tages of programming, most particularly that it clearlyshows where the progranuner's understanding and con>mand of his subject leaves off.

    A large part of whatever elegance may be credited toELI ZA lies in the fact tha t E LI ZA maintains the illusionof understanding with so little machinery. But. there arebounds on the extendability of ELIZA's "understanding"power, which arc a function of the ELIZA program itselfand not a function of any script it may be given. Thecrucial test of understanding, as every teacher shouldknow, is not the subject's ability to continue a conversa-tion, but to draw valid conclusions h'om what. he is beingtold. In order for a computer program to be able to dothat, it must at least have the capacity to store 8electedparts of its inputs. ELI ZA throws away each of its inpuls,except for those few transformed by means of the:\IIiL\:IOI{Y machi nery. Of course, the problem is morethan one of storage. A great part of it is, in fact, subsumedunder the word "selected" used just, above. ELIZA in itsuse so far has had as one of its principal objectives thec o t ~ c e t d m e n t of its lack of understanding. But to encourageits conversational partner to offer inputs from which itcan select remedial information, it, must re t ,e a l its mis-tmderstanding. A switch of objectives from the conceal-meat to the revelation of misunderstanding is seen as aprecondition to making an ELIZA-like program the basisfor an effective natural language ma n machine com-munication system.

    One goal for an augmented ELIZA program is thus asystem which already has access to a store of informationabout some aspects of the real world and which, by meansof conversational interaction with people, can reveal bothwhat it knows, i.e., behave as an infh)rmation retrievalsystem, and where its knowledge ends and needs to beaugmented. Hopefully the augmentation of its knowledgewill also be a direct consequence of its conversationalexperience. It is precisely the prospect that. such a programwill converse with many people and learn something fromeach of them, which leads to the hope that R will prove aninteresting and even useful conversational partner.

    One w~v to state a slightly different intermediate goal isto say that ELIZA should be given the power to slowlybuild a model of the subject conversing with it. If thesubject mentions that. he is not. married, for example, andlater speaks of his wife, then ELIZA should be able toVolume 9 / Number 1 / January, 1966

    make the tentative inference that he is either a widoor divorced. Of course, he could simply be confused./:he long run, EL IZ A should be able to build up a bs t r u c t u r e (to use Abelson's phrase) of the subject andthat basis detect the subject's rationalizations, condictions, etc. Conversations with such an ELIZA wooften turn into arguments, hnportant steps in the realtion of these goals have ah'cady been taken. Most notaamong these is Abelson's and Carroll's work on simulatof belief structures [1].

    The script that has formed the basis for most of discussion happens to be one with an overwhehninpsychological orientation. The reason for this has alrebeen discussed. There is a danger, however, that example will run away with what it is supposed to ilt.rate. It is useful to remember that the ELI ZA progitself is merely a translating processor in the technprogramming sense. Gem [2] in a paper on langusystems says:Given a language which already possesses semantic content, ta translating processor, even if it operates only syntacticagenerates correspondittg expressions of another language to wwe can attritmte as "meanings" (possibly multiple--the translamay not be one to one) the "semantic intents" of the generasource expressions; whether we find the result consistent or usor both is, of course, another problem. It is quite possible thathis method the same syntactic object language can be usefassigned multiple meanings for each expression. ..

    It is striking to note how well his words/fit ELIZA. T"given language" is English as is the "other languagexpressions of which arc generated. In principle, the gihmguage could as well be the kind of English in wh"wor d proble ms" in algebr~L am given to high schstudents and the other language, a machine code allowa particular computer to "solve" the stated problem(See Bobrow's program STUDENT [3].)The intent of the above remarks is to further rob EL Iof the aura of magic to which its application to psyclogical subject matter has to some extent contributSeen in the coldest possible light, ELIZA is a translatprocessor in Gorn's sense; however, it is one which been especially constructed to work well with natulanguage text.

    REFERENCES1. ABEl.SON, Pt. P., AND CARROLL, J. D. Computer si mulaof ind ividual belief systems. Am e r . Be hav . Se t . 9 (May 1924-30.2. Goax, S. Semiotic relationships in ambiguously stratifbmguage systems. Paper presented at Int. Colloq. AlgebrLinguistics and Automatic Theory , Hebrew U. of JerusalAug. 1964.3. Bomow, D. G. Natura l language inpu t for a computer prlem solving system. Doctoral thesis, Math. Dept., MCambridge, Mass., 1964.4. WEIZENB_~UM, J. Symmetric list processor. C o m m . A C M(Sept. 1963), 524-544.5. ROGEaS, C. C l i e n t C e n t e r e d T h e r a p y : C u r r e n t P r a c t i c e , I m p

    c a t i o n s a n d T h e o r y . Houghton Mifflin, Boston, 1951.6. YNGVE, J. C O M I T P ro g r a m n d n g M a n u a l . M[T Press, Cbridge, Mass., 1961.C o m m u n i c a t i o n s o f t h e A C M

  • 8/3/2019 Communications of the ACM 1966 Weizenbaum

    9/10

    A P P E N I O I X . A ~ a . E L I Z A Script

    (HOW DO YOU 00. PLEASE TELL ME YOUR PROBLEM)S T A R T( S O R R Y ( ( 0 ) ( P L E A S E D O N ' T A P O L I G I Z E )( A P O L O G I E S A R E N O T N E C E S S A R Y ) ( W H A T F E E L I N G SDO YOU HAVE WHEN YOU APO LOGIZ E) ( l I VE TOLD YOUTHAT APOLOGIES ARE NO T REQUIRED)))(DONT = DON'T)(CANT = CAN'T)(WONT = WONT)(REMEMBER S((0 YOU REMEMBER O) (DO YOU OFTEN THINK OF 4)(DOES THINKING OF ~ BRING ANYTHING ELSE TO MINO)(WHAT ELSE OO YOU REMEMBER)(WHY DO YOU REMEMBER 4 JUST NOW(WHAT IN THE PRESENT SITUATION REMINDS YOU OF ~)(WHAT IS THE CONNECTION BETWEENME AND ~))((0 DO I REMEMBER 0) (DID YOU THINK I WOULDFORGET 5)(WHY DO YOU THINK I SHOULD RECALL S NOW(WHAT ABOUT 5) (=WHAT) (YOU MENTIONED S))((0) (NEWKEY)))(IF 3 ((0 IF 0) (DO YOU THINK ITS LIKELY THAT 3) (DO YOU WISH THAT 3)(WHAT DO YOU THINK ABOUT 3) (REALLY, 2 3)))(WHAT DO YOU THINK ABOUT ~) (REALLY, 2 3)))(DREAMT ~ ((0 YOU DREAMT O)(REALLY, ~) (HAVE YOU EVER FANTASIED ~ WWLE YOU WEREAWAKE)(HAVE YOU DREAMT ~ BEFORE) (=DREAM) (NEWKFY)))(DREAMED = DREAMT ~ (=DREAMT))(DREAM 3 ((0) (WHAT DOES THAT DREAMSUODEST TOYOU)(OO YOU DREAMOFTEN) (WHAT PERSONS APPEAR IN YOUR DREAMS)(DON'T YOU BELIEVE THAT DREAMHAS SOMETHINC TO ~0 WITHYOURPROBLEM) (NEWKEY)))(DREAMS = DREAM3 (=DREAM))(HOW (=WHAT))(WHEN (=WHAT))(ALIKE 10 (=DIT))(SAME 10 (=DIT))(CERTAINLY (=YES))(FEEL DLIST(/BELIEF))(THINK DLIST(/BELIEF))(BELIEVE DLIST(/BELIEF))(WISH DLIST(/BELIEF))(MEMORY MY (0 YOUR0 = LETS DISCUSS FURTHER WHY YOUR 3)(0 YOUR 0 = EARLIER YOU SAID YOUR 3)(O YOUR 0 = BUT YOUR 3)(0 YOUR 0 = DOES THAT HAVE ANYTHING TO DO WITH THE FACT THAT YOUR 3))(NONE ((0) (I AM NOT SURE I UNDERSTAND YOU FULLY)(PLEASE GOON)(WHAT DOES THAT SUGGEST TO YOU)(DO YOU FEEL STRONGLY ABOUT DISCUSSING SUCH THINGS)))(PERHAPS ((0) (YOU DON'T SEEM QUITE CERTAIN)(WHY THE UNCERTAIN TONE)(CAN'T YOU BE MORE POSITIVE)(YOU AREN'T SURE) (DON~T YOU KNOW)))(MAYBE (=PERHAPS))(NAME 15 ((0) (I AM NOT {NTERESTED IN NAMES)(I'VE TOLD YOU BEFORE, I DON'T CARE ABOUT NAMES -PLEASE CONTINUE)) )PLEASE CONTINUE)) )(DEUTSCH (=XFREMD))( P R A N C A I S ( = X F R E M D ) )( I T A L I A N 0 ( = X F R E M D ) )( E S P A N O L ( = X F R E M D ) )( X FR E M D ( ( 0 ) ( I A M S O R R Y , I S P EA K O N L Y E N G L I S H ) ) )( H E L L O ( ( 0 ) ( H O W D O Y O U D O , P L E A S E S T A T E YO U R P R O R L F M ) ) )(COMPUTER 50 ( (O ) (DO COMPUTERS WORRY YOU)(WHY DO YOU MEN TION COM PUTERS) (WHAT DO YOU THINK MAC HINESHAVE TO DO WITH YOU R PROBLEM) (DO N'T YOU THINK COMPUTERS CANHELP PEOPLE) (WHAT ABOUT MAC HINES WORRIES YOU) (WHATD O Y O U T H I N K A B O U T M A C H I N E S ) ) )(MACHINE SO (=COMPUTER))(MACHINES 50 (=COMPUTER))(COMPUTERS 50 (=COMPUTER))(AM = ARE ((O ARE YOU O) (DO YOU BELIEVE YOU ARE ~)

    4 4 C o m m u n i c a t i o n s o f t h e A C M

    (WOU!D YOU WAN T TO BE ~ ) {YOU W ISH I WC UL0 TELL YOU YOU Ar E 4)(WHAT WOULD IT MEAN IF YOU WERE ~ ) (=W HA T) )( ( 0 ) ( W H Y O 0 YO U S A Y ' A M ' ) ( I D O N ~ T U N D ER S T gN O T H A T ) ) )(ARE ( (0 ARE I 0 )(WHY ARE YOU iNTERES TED IN WHETHFR I AM ~ OR NOT)(WOULD YOU PREFER IF ~ WE REN 'T ~ ) (PERHAPS i A~ ~ IN YOU~F A N T A S I E S ) ( D O Y OU S O M E T I M E S T H I N K I A M ~ ) ( = W ~ A T ) )( (O ARE 0) (D iD YOU THINK THEY MIGHT NOT BE 3)(WOULD YOU LIKE IT IF THEY WERE NOT 3) (WH AT !F THE Y WPRE NOT 3>( P O S S I B L Y T H E Y A R E 3 ) ) )(YOUR = MY ( ( 0 MY O) (W HY ARE YOU CONCERNED OVER MY 3)(WHAT ABOU T YOUR OWN 3) (ARE YOU WORR IED ABOUT SO~.!EONE ELSES 3)(REALLY, MY 3 ) ) )(WAS 2 ((0 WAS YOU 0 )(WHAT IF YOU WERE ~) (DO YOU THINK YOU WEREh)(WERE YOU k) (WHAT WOULD IT MEAN IF YOU WERE ~)(WHAT DOES ' 4 ' SUGGEST TO YOU) (=WHAT))((O YOU WAS O)(WERE YOU REALLY) (WHy DO YOU TELL ME YOU WERE ~ NOW(WERE YOU REALLY) (WHY DO YOU TELL ME YOU WERE ~ NOW)(PERHAPS I ALREADY KNEWYOUWEREh) )((O WAS I O) (WOULD YOU LIKE TO BELIEVE { WAS h)(WHAT SUGGESTS THAT I WAS ~)(WHAT DO YOU THINK) (PERHAPS I WAS q)(WHAT IF I HAD BEEN ~))((0) (NEWKEY)))(WERE = WAS (=WAS))(ME = YOU)(YOURE = I'M ((0 I'M 0) (PRE (I ARE S) (=YOU))))(I 'M = YOU'RE ((0 YOURE O) (PRE (YOU ARE 3) (=I ))))(MYSELF = YOURSELF)(YOURSELF = MYSELF)(MOTHER OLIST(/NOUN FAMILY))(NON = MOTHER DLIST(/ FAMILY))(DAD = FATHER DLIST(/ FAMILY))(FATHER DLIST(/NOUN FAMILY))(SISTER BLIST(/FAMILY))(BROTHER DLIST(/FAMILY))(WIFE D L I S T ( / F A M I L Y ) )( C H I L D R E N O L I S T ( / F A M I L Y ) )( I = YOU((0 YOU (* WANT NEED) O) (WHAT WOULD IT MEAN TO YOU IF YOU GOT ~)(WHY DO YOU WANT 4) (SUPPOSE YOU GOT ~ SOON) (WHATIF YOU NEVER GOT ~) (WHAT WOULDGETTING ~ MEAN TOYOU) (WHAT DOES WANTING ~ HAVE TO DO WITH THIS DISCUSSION))((0 YOU ARE O (-SAD UNHAPPY DEPRESSED SICK ) 0)(I AM SORRY TO HEAR YOU ARE 5) (DO YOU THINK COMING HEREWILL HELP YOU NOT TO BE 5) (I'M SURE ITS NOT PLEASANT TOBE 5) (CAN YOU EXPLAIN WHAT MADE YOU 5))((O YOU ARE O (-HAPPY ELATED GLAD BETTER ) 0)(HOW HAVE I HELPED YOU TO BE 5)(HAS YOUR TREATMENT MADE YOU 5) (WHAT MAKES YOU S JUSTNOW) (CAN YOU EXPLAIN WHY YOU ARE SUDDENLY 5))((0 YOU WAS O) (=WAS))((0 YOUWAS O) (:WAS))((O YOU (/BELIEF) YOU 0) (DO YOU REALLY THINK SO) (BUT YOU ARENOT SURE YOU 5) (DO YOU REALLY DOUBT YOU 5))((0 YOU 0 (/BELIEF) O I 0) (=YOU))((0 YOU ARE O)( IS IT BECAUSE YOU ARE ~ THAT YOU CAM E TO ME)( H O W L O N G H A V E Y O U B E E N 4 )( D O Y OU B E L I E V E I T N O R M A L T O B E ~ )(DO YOU ENJOY BEIN G 4) )((0 YOU (* CANIT CANNOT) G) (HOWDO YOU KNOWYOU CAN'T ~)( H A V E Y O U T R I E D )(PERHAPS YOU COULD ~ NOW)(DO YOU REALLY WA NT TO BE ABLE TO ~ ) )( ( 0 Y OU D O N I T 0 ) ( D O N I T Y O U R E A L L Y 4 ) ( W H Y D O N ' T YO U ~ )(DO YOU WIS H TO BE ABLE TO ~ ) (DOES THAT TROUBLE YO U) )( ( 0 Y O U F E E L 0 ) ( T E L L M E M O R E A B O U T S U C H P E E L I N G S )(DO YOU OFTEN FEEL ~ )( D O YO U E N J O Y F E E L I N G ~ )( O F W H A T D O ES F E E L I N G 4 R E M I N D Y O U ) )( ( 0 YOU G I 0) (PERHA PS IN YOUR FANTASY WE 3 EACH OTHER)(DO YOU WIS H TO 3 ME)( Y O U S E E N T O N E E D T O 3 M E )(DO YOU 3 ANYONE ELSE) )

    V o l u m e 9 / N u m b e r l / J a n u a r y , 1 9h 6i/

  • 8/3/2019 Communications of the ACM 1966 Weizenbaum

    10/10

    i : (

    3)

    s

    ;7

    ( ( o ) ( Y O U S A Y 1 )( C A N Y O U E L A B O R A T E O N T H A T ) ( ~ 0 Y ~ U S A Y Z F O R S D M E S ~ E C i A L R E A S O N )( T N A T t S Q U IT E I N T E R E S T I N G ) ) )(YOU = I ( ( 0 I RE WIND YOU OF O) ( -D I T) )( (O I ARE O) (WHAT M AK E S YOU THIN K i A~ h)(OOE S IT PLE ASE YOU TO RE LIE VE I A~: ~ )( DO Y O U SO M E T I M E S W I S H Y O U W E R E k )(PERHA PS YOU WOUL0 LIKE TO BE ~))((0 ! O YOU) (WH Y DO YOU TH INK I 3 YOU)(YOU LIKE TO TH INK I 3 YOU - DON 'T YOU)(WHAT MAKE S YOU THINK I 3 YOU)(REAL LY, I 3 YOU) (DO YOU WISH TO RFLIEVF I 3 YOU)( R E A L L Y , I 3 YO U ) ( 0 0 Y O U W I S H T O R E L I E V E I 3 Y O U )(SUPPOS E I DID 3 YOU - WHAT WOUL D THAT NEAt])( D O E S S O M E O N E E L SE B E L I E V E I 3 Y O U ) )( ( O i O ) ( W E W E R E D I S C U S S I N G Y O U - F i O T M E )(OH, I 3) (YOU'RE NOT REALLY TALKI~;G ABOUT ME - ARE YOU)(WHAT ARE YOUR FEELINGS NOW)))(YES ( (0) (YOU SEEM QUITE POSITIVE) (YOU AqE SURE)(! SEE) (I UNDERSTAND)))(NO ((0) (ARE YOU SAYING 'NO' JUST TO BE NEGATIVE)(YOU ARE BEING A BIT NEGATIVE) (WHY NOT) (WHY 'NO')))(MY = YOUR 2 ((D YOUR 0 (/FAMILY) 0)(TELL ME MOREABOUT YOUR FAMILY) ( WHO ELSE IN YOUR FAMILY5) (YOUR ~) (WHAT ELSE COMESTO MIND WHENYOU THINK OFYOUR ~))((0 YOUR O) (YOUR 3) (WHY DO YOU SAY YOUR )) (DOES THATSUGGEST ANYTHING ELSE WHICH BELONGS TO YOU) (IS ITIMPORTANT TO YOU THAT 2 3)))(CAN ((0 CAN I O) (YOU BELIEVE I CAN ~ DON'T YOU) (:WHAT)(YOU WANT ME TO BE ABLE TO ~) (PERHAPS YOU WOULD LIKE TO BEABLE TO 4 YOURSELF)) ((0 CAN YOU 0) (WHETHER OR NOT YOU CANDEPENDS ON YOU MORETHAN ON ME) (DO YOU WANT TO BE ABLE TO ~)(PERHAPS YOU DON'T WANT TO ~) (=WHAT)))(WHAT ((O) (WHY DO YOU ASK) (DOES THAT QUESTION INTFRrST YOU)(WHAT IS IT YOU REALLY WANT TO KNOW)(ARE SUCH QUESTIONS MUCHON YOUR MIND)(WHAT ANSWERWOULD PLEASE YOUMOST)(WHAT DO YOU THINK) (WHAT COMESTO YOUR MIND WHFNYOU ASK THAT)(HAVE YOu ASKED SUCH QUESTION BEFORE)(HAVE YOU ASKED ANYONE ELSE)))(BECAUSE ((0) (IS THAT THE REAL REASON) (nON'T A~!Y OTHER RPASONSCOME TOHIND) (DOES THAT REASONSEEM TO EXPLAIN ANYTHING ELSE)(WHAT OTHER REASONS MIGHT THERE BE)))(WHY ((O WHY DON'T I 0) (DO YOU BELIEVE I DONIT 5) (PERHAPS IWILL 5 IN GOODTIME) (SHOULD YOU 5 YOURSELF) (YOU WANT ME TO 5)( : W H A T ) )( = W H A T ) )((0 WHY CAN'T YOU O) (DO YOU THINK YOU SHOULD BE ABLE TO S)(DO YOU WANTTO BE ABLE TO 5) (DO YOU BFLIFVE THIS WILL HELP YOUTO 5) (HAVE YOU ANY IDEA WHY YOU CANfT 5) (=WHAT))(= WHAT))(EVERYONE 2 ((O (* EVERYONE EVERYBODY NOBODYNOONF) O )(REALLY, 2) (SURELY NOT 2) (CAN YOU THINK OFANYONE IN PARTICULAR) (WHO, FOR EXAMPLE) (YOU ARE THINKINO OFA VERY SPECIAL PERSON)(WHO, MAY I AS K) (SOMEONE SPECIAL PERHAPS)(YOU HAVE A PARTICULAR PERSON IN MINn , DON'T YOU) (WHO DO YOUTHINK YOURE TALKING ABOUT)))(EVERYBODY 2 (= EVERYONE))(NOBODY 2 (=EVERYONE))(NOONE 2 (:EVERYONE))(ALWAYS I (( 0 ) (CAN YOU THINK OF A SPECIFIC EXAMPLE) (WHEN)(WHAT INCIDENT ARE YOU THINKING OF) (REALLY, ALWAYS)))(LIKE 10 ((O (*AM IS ARE WAS) 0 LIKE O) (=DIT))(( 0) (NEWKEY)) )( D I T ( ( O ) ( I N W H A T W A Y ) ( W H A T R E S E M BL A N C E DO YO U S E E )( W HA T D O E S T H A T S I M I L A R I T Y S UG GE S T T O YO U)(WHA T OT HER C ONNEC TIONS DO YOU SEE)(WHA T DO YOU SUPPOSE THA T R ESEM BLA NC E MEA NS)(WHAT IS THE CONNECT ION, DO YOU SUPPOSE)(C OULD T H E R E R E A L L Y BE SOME C O N N E C T I O N )(HOW)))()

    I =~ E C EI V i. 3D S E P T E M B E R , 1 9 6 5

    V o h u n e 9 / N u m b e r 1 / J a n u a r y , 1 966

    LETTERS--continued from p. 35T h e , e c h n i q u e c o n s i s t s o f t r a n s l a t i n g t h e c o d e fo r t h e l e

    " O " t o ti m c o< tc f o r t h e n u m e r a l O w h e n e v e r i t i s e n e o m t t e r e d i n i n p u t c h a r a c t e r s t r i n g . I f t h e " ' ", r l t l g c o n s z s t s ( )l il y o f i t e m s s t l e hz ~ u ln b er s a n d n a n l e s a n d i t i s I l e c e s s a r y t o s o r t a l p h a b e t i c a l l y n a m e s , t h e o c c u r re n c e o f a n a l p h a b e t i c c h a r a c t e r w i t h i n a n af ie ld i s u s e d t o c a u s e t h e c o d e f o r z e r o t o b e r e t r a n s l a t e d t o c ( ,d e fo p * h e l e t l e r " O " b >" a r e s c a n o f l h e c h a r a c t e r s i n t h e n af i e l d .I f no s o r t i n g is r e q u i r e d , t h e r e t r a n s l a t i o n c a n b e a v o i d e d , pv i d e d t h a t d e l i m i t e r s s u c h a s F O R M A T o r G O T O a r e sp e lw i t h z e r o w i t h i n t h e r e c o g n i z e r s e g l n e n t o f a t r a n s l a t o r . I t, i s an e c e s s a r y to r e d e f i n e i d e n t i f i e r a si d e n t i f i e r ) : : = ( l et t er : :- ( i d e n t i f i e r ) ( f e t t e r 3 i ( i d e n t i f i e r > ( d i g i t

    ( 0 ) ( i d e n t . i f i e r )w h e r e i t i s u n d e r s t o o d t h a t t h e l e t t e r " O " i s r e m o v e d f r o m s t a n d a r d d e f i n i t i o n o f l e t t e r a s i n A LG O L 6 0 . T h e r e d e f i n i t i o n pm i t s t h e i n c l u s i o n o f i d e n t i f i e r s s u c h a s 017 )11 ) o r C O P S b u t p r e v et h e u s e o f a n i d e n t i ti e r c o n s i s t i n g o n l y o f th e r e p e a t e d i n a r k

    T h i s t e c h n i q u e r e q u i r e s c o n s i s t e n c y o f u s e a n d m i g h t r e s u l tc h a o s i n a w a t ' e h o u s i n g o p e r a t i o n i n w h i c h t i le le t t e r " 0 " i s u si li p a r t s l a b e l s w i t h c h e c k d i g i t s .

    L . R I CH : ~ .R D T U a N E R/ A T A S A L e w i s R c s v a r c h C e n// :/ C I e c e l a n d , O h i o/////~ J~ - ~ m m e n t s o n a P r o b l e m i n C o n c u r r e n t

    P r o g r a m m i n g C o n t r o lD e a r E d i t o r :

    I w o u l d l i ke t o c o r n m e n t o n M r . D i j k s t r a ' s s o l u t i o n [ S o l u t io f a p r o b le m i n c o n c u r r e n t p r o g r a m m i n g c o n t r o l . C o m m A C M( S e p t . 1 9 65 ) , 5 6 9] to a m e s s y p r ( ~ h l e m t h a t i s h a r d l y a c a d e m i c . Wa r e u s i n g i t n o w o n a m u l t i p l e c o m p u t e r c o m p l e x .

    W h e n t h e r e a r e o n l y t w o c o m p u t e r s , t h e a l g o r i t h m m a y s i m p l i f i e d t o t h e f o l l o w i n g :B o o l e a n a r r a y b E0 ; 1) i n t e g e r k , i , j ,c o m m e n t T h i s is t h e p r o g r a m f o r c o m p u t e r i, w h i c h m a y

    t i t h e r 0 o r 1 , c o m p u t e r j ~ i i s t h e o t h e r o n e , 1 o r 0;CO : b (i) : = f a l s e ;C I : i f k ~- i t h e n b e g i nC 2 : i f n o t b(j) t h e n g o t o C 2;

    e l s e k : = i ; g o t o C 1 e n d ;e l s e c r i t i c a l s e c t i o n ;b(i) : = t r u e ;r e m a i n d e r o f p r o g r a m ;g o t o C 0 ;e n d

    M r . D i j k s t r a h a s c o m e u p w i t h a c l e v e r s o l u t i o n t o a r e a lp r a c t i c a l p r o b l e m .HARRI S H Y$.[ANM u n i t y p eN e w Y o r k , N e w Y o

    C o m m u n i c a t i o n s o f t i l e A C M 4