LING 388: Language and Computers Sandiway Fong Lecture 10: 9/26.

Slides:



Advertisements
Similar presentations
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Advertisements

LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong. Administrivia Homework 3 graded.
Theory Of Automata By Dr. MM Alam
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 13: 10/9.
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong. Administrivia We'll postpone Homework 4 review until next week …
LING 388: Language and Computers Sandiway Fong Lecture 9: 9/27.
LING 388: Language and Computers Sandiway Fong 9/29 Lecture 11.
Finite-state automata 2 Day 13 LING Computational Linguistics Harry Howard Tulane University.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 16: 10/19.
Regular Expressions (RE) Used for specifying text search strings. Standarized and used widely (UNIX: vi, perl, grep. Microsoft Word and other text editors…)
LING 438/538 Computational Linguistics Sandiway Fong Lecture 8: 9/29.
LING 388: Language and Computers Sandiway Fong Lecture 9: 9/22.
1 Regular Expressions and Automata September Lecture #2-2.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/12.
CS5371 Theory of Computation
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 10: 9/27.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 12: 10/4.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 9: 9/21.
LING 388: Language and Computers Sandiway Fong Lecture 21: 11/7.
LING 388: Language and Computers Sandiway Fong Lecture 12: 10/5.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 8: 9/18.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/11.
LING 388 Language and Computers Lecture 8 9/25/03 Sandiway FONG.
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/6.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 10: 9/26.
LING 388 Language and Computers Lecture 4 9/11/03 Sandiway FONG.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 11: 10/3.
Computational Language Finite State Machines and Regular Expressions.
LING 388: Language and Computers Sandiway Fong Lecture 6: 9/13.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/3.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 12: 10/5.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
LING 388 Language and Computers Lecture 7 9/23/03 Sandiway FONG.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 11: 10/2.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 5: 9/5.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 14: 10/12.
Costas Busch - LSU1 Non-Deterministic Finite Automata.
1 Non-Deterministic Finite Automata. 2 Alphabet = Nondeterministic Finite Automaton (NFA)
LING 388 Language and Computers Lecture 6 9/18/03 Sandiway FONG.
March 1, 2009 Dr. Muhammed Al-mulhem 1 ICS 482 Natural Language Processing Regular Expression and Finite Automata Muhammed Al-Mulhem March 1, 2009.
LING/C SC/PSYC 438/538 Lecture 7 9/15 Sandiway Fong.
LING 388: Language and Computers Sandiway Fong Lecture 6: 9/15.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
LING/C SC/PSYC 438/538 Lecture 12 10/4 Sandiway Fong.
Corpus Linguistics- Practical utilities (Lecture 7) Albert Gatt.
2. Regular Expressions and Automata 2007 년 3 월 31 일 인공지능 연구실 이경택 Text: Speech and Language Processing Page.33 ~ 56.
LING 388: Language and Computers Sandiway Fong 9/27 Lecture 10.
LING/C SC/PSYC 438/538 Lecture 13 Sandiway Fong. Administrivia Reading Homework – Chapter 3 of JM: Words and Transducers.
Finite-state automata Day 12 LING Computational Linguistics Harry Howard Tulane University.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong. Adminstrivia Homework 4 not yet graded …
LING/C SC/PSYC 438/538 Lecture 14 Sandiway Fong. Administrivia Homework 6 graded.
Natural Language Processing Lecture 4 : Regular Expressions and Automata.
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
LING/C SC/PSYC 438/538 Lecture 16 Sandiway Fong. SWI Prolog Grammar rules are translated when the program is loaded into Prolog rules. Solves the mystery.
Lecture 04: Theory of Automata:08 Transition Graphs.
CSCI 3130: Formal languages and automata theory Tutorial 1 Lee Chin Ho.
BİL711 Natural Language Processing1 Regular Expressions & FSAs Any regular expression can be realized as a finite state automaton (FSA) There are two kinds.
Theory of Computation Automata Theory Dr. Ayman Srour.
WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Dr. Mohammad Nassef Department of Computer Science, Faculty of Computers and Information, Cairo University.
Non Deterministic Automata
Non-Deterministic Finite Automata
Non-Deterministic Finite Automata
CSE322 Definition and description of finite Automata
Non Deterministic Automata
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong.
Mealy and Moore Machines
Part Two : Nondeterministic Finite Automata
Presentation transcript:

LING 388: Language and Computers Sandiway Fong Lecture 10: 9/26

2 Adminstrivia Reminders –No class Thursday –Homework 3 due Thursday Correction –Homework Exercise 2 –Question 4 (1pt) Why is the answer different from a simple spokes* search? –Reword as: Why could the answer different from a simple spokes* search?

3 Last Time... into detail with Microsoft Word’s regular expression facility –Find with wildcard option enabled –somewhat limited form of regular expression search

4 Today’s Topic Finite State Automata (FSA) equivalent to the regular expressions we’ve been studying

5 Regular Expressions: Example.... from lecture 8 example (sheeptalk) –ba! –baa! –baaa! … regular expression –baa*! –ba+!

6 Regular Expressions: Example.... from lecture 6 example (sheeptalk) –ba! –baa! –baaa! … regular expression –baa*! –ba+! sx z b ! y a a >

7 Regular Expressions: Example step-by-step regular expression –baa*! s >

8 Regular Expressions: Example step-by-step regular expression –baa*! –b –from s, –see a ‘b’, –move to x sx b >

9 Regular Expressions: Example step-by-step regular expression –baa*! –ba –from x, –see an ‘a’, –move to y sx b y a >

10 Regular Expressions: Example step-by-step regular expression –baa*! –baa* –ba –baa –baaa –baaaa... –from y, –see an ‘a’, –move to ? sx b y a > y’ y” a a a... but machine must have a finite number of states!

11 Regular Expressions: Example step-by-step regular expression –baa*! –baa* –ba –baa –baaa –baaaa... –from y, –see an ‘a’, –“loop” or move back to y sx b y a a >

12 Regular Expressions: Example step-by-step regular expression –baa*! –from y, –see an ‘!’, –move to final state z (indicated in red) sx z b ! y a a > Note: machine cannot finish (i.e. reach the end of the input string) in states s, x or y

13 Finite State Automata (FSA) construction –the step-by-step FSA construction method we just used –works for any regular expression conclusion –anything we can encode with a regular expression, we can build a FSA for it –an important step in showing that FSA and REs are equivalent

14 Microsoft Word Wildcards basic wildcards –? and * ? any single character e.g. p?tput, pit, pat, pet *zero or more characters xy d a b c e z etc.... y a etc. one loop for each character

15 Microsoft Word Wildcards basic wildcards one or more of the preceding character e.g. –[ ] range of characters e.g. [aeiou] xy a a xy o a e i u

16 Microsoft Word Wildcards basic wildcards – < beginning of a word can think of there being a special symbol/invisible character marking the beginning of each word > end of a word suppose there is an invisible character marking the end of each word xy < see anything but ‘<‘ xy > see anything but ‘>‘

17 Microsoft Word Wildcards basic wildcards – > end of a word –Note the see-anything-but loop is implicit m> “word that ends in m” example: –mom is... xy > see anything but ‘>‘ xy m see anything but ‘m‘ z >

18 Finite State Automata (FSA) more formally –(Q,s,f,Σ,  ) 1.set of states (Q): {s,x,y,z} 4 statesmust be a finite set 2.start state (s): s 3.end state(s) (f): z 4.alphabet ( Σ ): {a, b, !} 5.transition function  : signature: character × state → state  (b,s)=x  (a,x)=y  (a,y)=y  (!,y)=z sx z b ! y a a >

19 Finite State Automata (FSA) in Prolog –define one predicate for each state taking one argument (the input string L ) consume input character call next state with remaining input string –query fsa(L) :- s(L). i.e. call start state s

20 Finite State Automata (FSA) state s: (start state) –s([b|L]) :- x(L). match input string beginning with b and call state x with remainder of input state x: –x([a|L]) :- y(L). state y: –y([a|L]) :- y(L). –y(['!'|L]) :- z(L). state z: (end state) –z([]). sx z b ! y a a >

21 Finite State Automata (FSA) query –?- s([b,a,a,’!’]). sx z b ! y a a > Database s([b|L]) :- x(L). x([a|L]) :- y(L). y([a|L]) :- y(L). y(['!'|L]) :- z(L). z([]). query –?- s([b,a,b,a,’!’]). –in which state does this query fail? [b,a,a,’!’][a,a,’!’] [a,’!’] [’!’] [] [b,a,b,a,’!’] [a,b,a,’!’] [b,a,’!’]

22 FSA Finite State Automata (FSA) have a limited amount of expressive power Let’s look at a modification to FSA and its effect on its power

23 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

24 Finite State Automata (FSA) equivalent s z ba ! y a > sx z b ! y a a > 4 state machine

25 Finite State Automata (FSA) equivalent s z ba ! y a > sx z b ! y a a > Database s([b|L]) :- x(L). x([a|L]) :- y(L). y([a|L]) :- y(L). y(['!'|L]) :- z(L). z([]). Database s([b,a|L]) :- y(L). y([a|L]) :- y(L). y(['!'|L]) :- z(L). z([]).