Download presentation

Presentation is loading. Please wait.

Published byTaniya Comly Modified over 3 years ago

1
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 13: 10/9

2
Administrivia Homework 2 –grade (to be) sent by email today Upcoming midterm –this Thursday

3
NDFSA → (D)FSA: Recap set of states construction –new machine simulates in parallel all possible situations for the original machine procedure must terminate –4 states –2 4 -1=15 possible different states in the new machine sx z a a a b y b b a b

4
Practice Question convert the NDFSA into a deterministic FSA implement both the NDFSA and the equivalent FSA in Prolog using the “one predicate per state” encoding run both machines on the strings abab and abaaba, –how many steps (transitions + final stop) does each machine make? from figure 2.27 in the textbook

5
Today’s Topics FSA to regexp FSA and complementation Regexp and complementation

6
FSA to Regexp Give a Perl regexp for this FSA

7
FSA to Regexp Let’s define E i to be the possible strings that can lead to an accepting computation from state i Then: –E1 = aE2 –E2 = bE3 | bE4 –E3 = aE2 | λ –E4 = aE3

8
FSA to Regexp Solve simultaneous equations –E1 = aE2 –E2 = bE3 | bE4 –E3 = aE2 | λ –E4 = aE3

9
FSA to Regexp Solve simultaneous equations –E1 = aE2 –E2 = bE3 | bE4 (eliminate) –E3 = aE2 | λ –E4 = aE3 Then –E1 = abE3 | abE4 –E3 = abE3 | abE4 | λ

10
FSA to Regexp Solve reduced equations –E1 = abE3 | abE4 –E3 = abE3 | abE4 | λ –E4 = aE3

11
FSA to Regexp Solve reduced equations –E1 = abE3 | abE4 –E3 = abE3 | abE4 | λ –E4 = aE3 (eliminate E4) Then –E1 = abE3 | abaE3 –E3 = abE3 | abaE3 | λ

12
FSA to Regexp Solve reduced equations –E1 = abE3 | abaE3 –E3 = abE3 | abaE3 | λ Solve recursive definition for E3 rewrite E3 as –E3 = (ab|aba)E3 | λ E3 ab|aba

13
FSA to Regexp Then –E1 = abE3 | abaE3 –E3 = (ab|aba)* E3 ab|aba Also –E1 = (ab|aba)E3 Substituting for E3 –E1 = (ab|aba)(ab|aba)*

14
FSA to Regexp –E1 = (ab|aba)(ab|aba)* We know –e+ = ee* = e*e Hence –E1 = (ab|aba)+ Note: the order of variable elimination matters

15
FSA and Complementation FSA are closed under complementation –i.e. make a new FSA’ accept strings rejected by FSA, and reject strings accepted by FSA over the alphabet –∑= {a,b} reject b a b b a,b

16
FSA and Complementation A Simple Idea: –make old accepting state(s) non-final states –make non-final and reject states accepting states Nearly correct, but why does this not work? –hint: consider aba reject b a b b a,b 1 2 3 4 5

17
FSA and Complementation Prolog 1.one([a|L]) :- two(L). 2.two([b|L]) :- three(L). 3.two([b|L]) :- four(L). 4.three([]). 5.three([a|L]) :- two(L). 6.four([a|L]) :- three(L). To construct the complement FSA in Prolog: –add a single line 7.fsab(L) :- \+ one(L). \+ is the Prolog operator for negation as failure to prove –i.e. –\+ one(L) is true if one(L) cannot be true –\+ one(L) is false if one(L) can be true weakness is that \+ can’t be used to generate

18
Regexps and Complementation Not part of basic regexps Formally, we can define: –complement of regexp e = ∑ * – e –where ∑ * = set of all possible strings over alphabet ∑ i.e. zero or more occurrences... Class Exercise –Let ∑= {a,b} –Give a Perl regexp equivalent to the complement regexp for (ab|aba)+

Similar presentations

OK

LING 388: Language and Computers Sandiway Fong Lecture 6.

LING 388: Language and Computers Sandiway Fong Lecture 6.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on spiritual leadership institute Ppt on review of literature definition Ppt on smoking is injurious to health Ppt on ufo and aliens videos Ppt on business environment nature concept and significance of palm Ppt on formation of joint stock company Ppt on conservation of wildlife and natural vegetation of india Lecture ppt on digital image processing Ppt on ozone layer Ppt on point contact diode operation