Download presentation

Presentation is loading. Please wait.

Published byNyah Mothershed Modified over 2 years ago

1
LING 388: Language and Computers Sandiway Fong Lecture 9: 9/27

2
Adminstrivia Reminder –Homework 2 due tonight –Need Help?

3
Administrivia some lectures are now available on the course hompage in audio format –as MP3 files –courtesy of Josh Harrison

4
Last Time Expressing regular expressions as FSA

5
Last Time Expressing regular expressions as FSA Microsoft Word Wildcards –@ one or more of the preceding character e.g. a@ –[ ] range of characters e.g. [aeiou] xy a a xy o a e i u

6
Last Time Prolog FSA implementation –regular expression: ba + ! –query ?- s([b,a,a,’!’]). –code one predicate per state (but each predicate may have more than one rule) –s([b|L]) :- x(L). sx z b ! y a a > –y([a|L]) :- y(L). –y([‘!’|L]) :- z(L). –z([]). –x([a|L]) :- y(L).

7
Today’s Topic More on the power of FSA …

8
FSA Finite State Automata (FSA) have a limited amount of expressive power Let’s look at some modifications to FSA and their effects on its power

9
String Transitions –so far... all machines have had just a single character label on the arc so if we allow strings to label arcs –do they endow the FSA with any more power? b Answer: No –because we can always convert a machine with string-transitions into one without abb abb

10
Empty Transitions –so far... all machines have had just a single character label on the arc how about allowing the empty string? –i.e. go from x to y without seeing a input character –does this endow the FSA with any more power? b Answer: No –because we can always convert a machine with empty transitions into one without xy

11
Empty Transitions example –(ab)|b a b a b b

12
NDFSA Basic FSA –deterministic it’s clear which state we’re always in, or deterministic = no choice point NDFSA –ND = non-deterministic i.e. we could be in more than one state non-deterministic choice point –example: initially, either in state 1 or 2 sx y a a b b 12 a 3 b > >

13
NDFSA more generally –non-determinism can be had not just with -transitions but with any symbol example: –given a, we can proceed to either state 2 or 3 12 a a 3 b >

14
NDFSA –are they more powerful than FSA? –similar question asked earlier for -transitions –Answer: No –We can always convert a NDFSA into a FSA example –(set of states) 12 a a 3 b 1 2,3 a 3 b 2 > >

15
NDFSA example –(set of states) trick: –construct new machine with states = set of possible states of the old machine 12 a a 3 b > {1} > a > {2,3} {3}{3} ba {1} > {2,3} {3} ba {1} > {2,3} 1 2,3 a 3 b 2 >

16
Equivalence FSANDFSA FSA with -transitions same expressive power

17
NDFSA and Prolog we have already seen how to encode a regular FSA in Prolog –(using one predicate per state) s([b|L]) :- x(L). x([a|L]) :- y(L). y([a|L]) :- y(L). y([‘!’|L]) :- z(L). z([]). s([b|L]) :- x(L). x([a|L]) :- y(L). y([a|L]) :- y(L). y([‘!’|L]) :- z(L). z([]). sx z b ! y a a >

18
NDFSA and Prolog we can do the same for NDFSA –without the set-of-states conversion to FSA –let Prolog ’ s computation rule keep track of the possible states and choice points for us s([a|L]) :- x(L). s([a|L]) :- y(L). x([b|L]) :- y(L). y([]). s([a|L]) :- x(L). s([a|L]) :- y(L). x([b|L]) :- y(L). y([]). sx a a y b >

19
NDFSA and Prolog computation tree –?- s([a]).L=[] rule 1 ?- x([]). –No ?- y([]).L=[] rule 2 –Yes rule 4 1.s([a|L]) :- x(L). 2.s([a|L]) :- y(L). 3.x([b|L]) :- y(L). 4.y([]). 1.s([a|L]) :- x(L). 2.s([a|L]) :- y(L). 3.x([b|L]) :- y(L). 4.y([]). sx a a y b >

20
-Transitions and Prolog earlier example s([a|L]):- x(L). s(L):- x(L). x([b|L]):- y(L). y([]). s([a|L]):- x(L). s(L):- x(L). x([b|L]):- y(L). y([]). sx a y b >

21
-Transitions and Prolog Computation tree: –?- s([b]). rule 2 ?- x([b]).L=[] rule 3 –?- y([]). rule 4 »Yes 1.s([a|L]):- x(L). 2.s(L):- x(L). 3.x([b|L]):- y(L). 4.y([]). 1.s([a|L]):- x(L). 2.s(L):- x(L). 3.x([b|L]):- y(L). 4.y([]). sx a y b >

Similar presentations

OK

LING 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/12.

LING 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/12.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on clutch system in automobile Ppt on principles of object-oriented programming polymorphism Ppt on polytene chromosomes in salivary Ppt on reaction intermediates Ppt on time management for students Ppt on hotel management career Free ppt on brain machine interface program Compress ppt online free Ppt on power system stability equal area Ppt on l&t finance india