Logic and Knowledge Representation L a n g u a g e P r o c e s s i n g , M e t a - p r o g r a m m i n g 1 J u n e 2 0 1 8 G i o v a n n i S i l e n o g s i l e n o @e n s t . f r T é l é c o m P a r i s T e c h , P a r i s - D a u p h i n e U n i v e r s i t y
Natural Language Processing
About talking machines... ● T h e d r e a m o f m a c h i n e t a l k i n g t o h u m a n s i s p r e s e n t i n m a n y fj c t i o n a l w o r k s . . . C-3PO, R2-D2 (Star Wars) Hal 9000 Data (Star Trek) Samantha
About talking machines... ● T h e d r e a m o f m a c h i n e t a l k i n g t o h u m a n s i s p r e s e n t i n m a n y fj c t i o n a l w o r k s . . . e v e n i n a n c i e n t t i m e s ! From the Iliad, Book XVIII: “There were golden handmaids also who worked for him [Hephaestus], and were like real young women, with sense and reason, voice also and strength, and all the learning of the immortals.”
About talking machines... V a r i a t i o n s o f t h e ( i n ) f a m o u s “ T u r i n g t e s t ”
First “concrete” attempts E L I Z A We i z e n b a u m ~ 1 9 6 5
First “concrete” attempts E L I Z A We i z e n b a u m ~ 1 9 6 5 I f y o u h a v e e m a c s , t r y M-x doctor
First “concrete” attempts S H R D L U Wi n o g r a d ~ 1 9 6 9 ● D e e p e r u n d e r s t a n d i n g ● b u t l i m i t e d t o a s i m p l e b l o c k s w o r l d
Today? ● B u t d o a u t o m a t i c t r a n s l a t o r s “ u n d e r s t a n d ” w h a t w e s a y ?
Winograd Schema Challenge ● P r o p o s e d b y L e v e s q u e i n 2 0 1 4 t o g o b e y o n d t h e T u r i n g t e s t , i t c o u n t s t o d a y 1 4 0 s e n t e n c e s a s : “The city councilmen refused the demonstrators a permit because they [feared/advocated] violence.” ● T o w h o m t h e y r e f e r s ?
Winograd Schema Challenge ● P r o p o s e d b y L e v e s q u e i n 2 0 1 4 t o g o b e y o n d t h e T u r i n g t e s t , i t c o u n t s t o d a y 1 4 0 s e n t e n c e s a s : “The city councilmen refused the demonstrators a permit because they [feared/advocated] violence.” ● T o w h o m t h e y r e f e r s ? ● P r o b l e m : r e s o l v i n g a n a p h o r a s
Levels of linguistic processing [ S l i d e b y F a b i a n S u c h a n e k , T é l é c o m P a r i s T e c h ]
Levels of linguistic processing ● A l l t h e s e l e v e l s p l a y a r o l e w i t h l a n g u a g e ! [ S l i d e b y F a b i a n S u c h a n e k , T é l é c o m P a r i s T e c h ]
not only in verbal language... V i t t o r e C a r p a c c i o , D u e D a m e , ~ 1 4 9 5
not only in verbal language... B e w a r e o f c o n t e x t ! V i t t o r e C a r p a c c i o , D u e D a m e + C a c c i a i n v a l l e , ~ 1 4 9 5 r e c o n s t r u c t i o n o f t h e o r i g i n a l p a i n t i n g
Language Processing in Prolog
Prolog and Context-Free Grammars ● A l a i n C o l m e r a u e r a n d P h i l i p p e R o u s s e l c o n c e i v e d P r o l o g ( 1 9 7 2 ) t o f a c i l i t a t e s y n t a x i c p r o c e s s i n g , f o l l o w i n g t h e t h e o r y o f c o n t e x t - f r e e g r a m m a r s . ● C F G s w e r e i n t r o d u c e d i n l i n g u i s t i c s b y N o a m C h o m s k y t o c l e a r l y d i s t i n g u i s h s y n t a x f r o m s e m a n t i c s [ a n d t o a t t a c k s i m p l e s t a t i s t i c a l m o d e l s o f l a n g u a g e . ] Colorless green Furiously sleep ideas sleep ideas green furiously. colorless.
Context-Free Grammar ● A c o n t e x t - f r e e g r a m m a r G i s d e fj n e d b y G = ( V , Σ , R , S ) – V i s t h e fj n i t e s e t o f n o n - t e r m i n a l c h a r a c t e r s ( v a r i a b l e s ) , s t a n d i n g f o r t h e s y n t a x i c c a t e g o r y – Σ i s a fj n i t e s e t o f t e r m i n a l s y m b o l s , d i s j o i n t f r o m V , s t a n d i n g f o r t h e a c t u a l c o n t e n t o f t h e s e n t e n c e – R i s a s e t o f r e w r i t e o r p r o d u c t i o n r u l e s o f t h e g r a m m a r , i . e . ∪ Σ ) * m a p p i n g s f r o m V t o ( V ( * = K l e e n e s t a r s y m b o l ) – S i s t h e s t a r t s y m b o l , u s e d t o r e p r e s e n t t h e w h o l e s e n t e n c e ( o r p r o g r a m ) . I t b e l o n g s t o V .
Context-Free Grammar ● A c o n t e x t - f r e e g r a m m a r G i s d e fj n e d b y G = ( V , Σ , R , S ) ● T h e l a n g u a g e L ( G ) o f a g r a m m a r G i s d e fj n e d a s : L(G) = { w ∈ Σ * / S ⇒ * w } ● A w o r d i n L ( G ) d e r i v e s f r o m S a n d c o n t a i n s o n l y t e r m i n a l s y m b o l s . ● A l a n g u a g e L i s a c o n t e x t - f r e e l a n g u a g e i f t h e r e i s a c o n t e x t - f r e e g r a m m a r G , s u c h t h a t L ( G ) = L .
Regular Expressions ● R e g u l a r e x p r e s s i o n s c o n s i s t o f : – c o n s t a n t s , d e n o t i n g s e t s o f s t r i n g s ● ∅ d e n o t i n g t h e e m p t y s e t : { } ● ε d e n o t i n g t h e s e t c o n t a i n i n g o n l y t h e e m p t y s t r i n g : { “ ” } ● a d e n o t i n g t h e s e t c o n t a i n i n g o n l y t h e s t r i n g “ a ” : { “ a ” }
Regular Expressions ● R e g u l a r e x p r e s s i o n s c o n s i s t o f : – c o n s t a n t s , d e n o t i n g s e t s o f s t r i n g s ● ∅ d e n o t i n g t h e e m p t y s e t : { } ● ε d e n o t i n g t h e s e t c o n t a i n i n g o n l y t h e e m p t y s t r i n g : { “ ” } ● a d e n o t i n g t h e s e t c o n t a i n i n g o n l y t h e s t r i n g “ a ” : { “ a ” } – o p e r a t o r s y m b o l s , d e n o t i n g o p e r a t i o n s o v e r s e t s . g i v e n t w o s e t s d e n o t e d w i t h R a n d S , w e h a v e : ● R S ( c o n c a t e n a t i o n ) : d e n o t e s t h e s e t o f s t r i n g s o b t a i n e d b y c o n c a t e n a n t i n g a s t r i n g o f R a n d a s t r i n g o f S ● R | S ( a l t e r n a n c e ) : d e n o t e s t h e s e t o f s t r i n g s o b t a i n e d b y t h e u n i o n o f R a n d S ● R ε * ( K l e e n e s t a r ) : d e n o t e s s e t t h e i n c l u d i n g , a n d a l l p o s s i b l e c o n c a t e n a t i o n s o f s t r i n g s i n R ( c l o s e d u n d e r c o n c a t e n a t i o n ) .
Context-Free vs Regular languages ● A r e g u l a r l a n g u a g e i s a l a n g u a g e t h a t c a n b e e x p r e s s e d t h r o u g h a r e g u l a r e x p r e s s i o n , o r e q u i v a l e n t l y , b y a fj n i t e s t a t e m a c h i n e ( K l e e n e ' s T h e o r e m ) . ● A l l r e g u l a r l a n g u a g e s a r e c o n t e x t - f r e e l a n g u a g e s , b u t n o t o t h e r w i s e . ● E ∈ n n x a m p l e : { 0 1 : n N } i s n o t r e g u l a r
Recommend
More recommend