Agenda. Agenda. Regular Expressions. Examples of Regular Expressions. Regular Expressions (crash course) Computational Linguistics 1

Similar documents
Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Theory of Computation Regular Languages

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Java II Finite Automata I

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata

CS375: Logic and Theory of Computing

FABER Formal Languages, Automata and Models of Computation

Finite-State Automata: Recap

Fundamentals of Computer Science

Non-Deterministic Finite Automata

Non-deterministic Finite Automata

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

Deterministic Finite-State Automata

Lecture 6 Regular Grammars

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Faster Regular Expression Matching. Philip Bille Mikkel Thorup

3 Regular expressions

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

Normal Forms for Context-free Grammars

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Regular expressions, Finite Automata, transition graphs are all the same!!

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

1.3 Regular Expressions

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Non-deterministic Finite Automata

Context-Free Grammars and Languages

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

More on automata. Michael George. March 24 April 7, 2014

Lecture 08: Feb. 08, 2019

Harvard University Computer Science 121 Midterm October 23, 2012

CISC 4090 Theory of Computation

Minimal DFA. minimal DFA for L starting from any other

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

NFAs continued, Closure Properties of Regular Languages

Chapter 2 Finite Automata

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Scanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy:

1 Nondeterministic Finite Automata

State Minimization for DFAs

Deterministic Finite Automata

Tutorial Automata and formal Languages

a b b a pop push read unread

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

Lexical Analysis Part III

Finite Automata-cont d

NFAs continued, Closure Properties of Regular Languages

CS 275 Automata and Formal Language Theory

1.4 Nonregular Languages

Let's start with an example:

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

CHAPTER 1 Regular Languages. Contents

Regular Languages and Applications

Closure Properties of Regular Languages

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Formal Languages and Automata

CMSC 330: Organization of Programming Languages

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

2. Lexical Analysis. Oscar Nierstrasz

Designing finite automata II

First Midterm Examination

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

CS375: Logic and Theory of Computing

Formal languages, automata, and theory of computation

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Lexical Analysis Finite Automate

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

More general families of infinite graphs

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

1 From NFA to regular expression

Thoery of Automata CS402

Part 5 out of 5. Automata & languages. A primer on the Theory of Computation. Last week was all about. a superset of Regular Languages

Nondeterminism and Nodeterministic Automata

I. Theory of Automata II. Theory of Formal Languages III. Theory of Turing Machines

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

This lecture covers Chapter 8 of HMU: Properties of CFLs

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...

Convert the NFA into DFA

Some Theory of Computation Exercises Week 1

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Automata and Languages

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

Uninformed Search Lecture 4

Homework 3 Solutions

i 1 i 2 i 3... i p o 1 o 2 AUTOMATON q 1, q 2,,q n ... o q Model of a automaton Characteristics of automaton:

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016

Transcription:

Agend CMSC/LING 723, LBSC 744 Kristy Hollingshed Seitz Institute for Advnced Computer Studies University of Mrylnd HW0 questions? Due Thursdy before clss! When in doubt, keep it simple... Lecture 2: 6 September 2011 2 Agend Regulr Expressions HW0 questions? Due Thursdy before clss! A met-lnguge for specifying simple clsses of strings Very useful in serching nd mtching text strings re everywhere! Implementtions in the shell (sed, wk, bsh, grep), Perl, Jv, Python, 3 4 Regulr Expressions (crsh course) Exmples of Regulr Expressions [-z] exctly one lowercse letter [-z]* zero or more lowercse letters [-z]+ one or more lowercse letters [-z]? zero or one lowercse letters [-za-z0-9] one lowercse or uppercse letter, or digit [^(] mtch nything tht is not '(' Bsic regulr expressions /hppy/ hppy /[bcd]/, b, c, d /[-d]/, b, c, d /[^-d]/ e, f, g, z /[Tt]he/ The, the /(dog ct)/ dog, ct Specil metchrcters /colou?r/ color, colour /oo*h!/ oh!, ooh!, oooh!, /oo+h!/ ooh!, oooh!, ooooh!, /beg.n/ begn, begin, begun, begbn, 5 6 1

Agend Equivlence Reltions We cn sy the following describe regulr lnguge cn be implemented by finite-stte utomt Regulr lnguges cn be generted by regulr grmmrs Finite-Stte Automt Regulr Expressions Regulr Lnguges Regulr Grmmrs 7 8 Chomsky Hierrchy Context-free Lnguge Mechnisms Exmples Regulr Context-free Context-sensitive Regulr expressions Regulr grmmrs Finite-stte utomt Finite-stte trnsducers WFSAs/WFSTs Context-free grmmrs (CFGs) Pushdown utomt Unifiction grmmrs Lexiclized formlisms (e.g., TAG, CCG) x n y Morphology Phonology Tggers n b n Most syntx n b m c n d m Cross-seril dependencies 9 10 Chomsky Hierrchy Context-sensitive: Unifiction Lnguge Mechnisms Exmples Regulr Context-free Context-sensitive Regulr expressions Regulr grmmrs Finite-stte utomt Finite-stte trnsducers WFSAs/WFSTs Context-free grmmrs (CFGs) Pushdown utomt Unifiction grmmrs Lexiclized formlisms (e.g., TAG, CCG) x n y Morphology Phonology Tggers n b n Most syntx n b m c n d m Cross-seril dependencies 11 12 2

Context-sensitive: Cross-seril Dependencies Context-sensitive: Cross-seril Dependencies 13 14 Context-sensitive: Cross-seril Dependencies Chomsky Hierrchy Lnguge Mechnisms Exmples Regulr Context-free Context-sensitive Regulr expressions Regulr grmmrs Finite-stte utomt Finite-stte trnsducers WFSAs/WFSTs Context-free grmmrs (CFGs) Pushdown utomt Unifiction grmmrs Lexiclized formlisms (e.g., TAG, CCG) x n y Morphology Phonology Tggers n b n Most syntx n b m c n d m Cross-seril dependencies 15 16 Sheep-speech Automton Lnguge: b! b! b! b!... Regulr Expression: /b+!/ Nturl Lnguge Automton Finite-Stte Automton: b! 17 18 3

Nturl Lnguge Automton Finite-Stte Automt (FSA) Forml definitions Wht re they? Wht do they do? How do they work? 19 20 FSA: Wht re they? Q: finite set of N sttes Q = {q 0, q 1, q 2, q 3, q 4 } The strt stte: q 0 The set of finl sttes: F = {q 4 } Σ: finite input lphbet of symbols Σ = {, b,!} δ(q,i): trnsition function Given stte q nd input symbol i, return new stte q' FSA: Stte Trnsition Tble Input Stte b! 0 1 1 2 2 3 3 3 4 4 δ(q 3,!) q 4 b! b! 21 22 FSA: Wht do they do? Given string, FSA either rejects or ccepts it b! reject b! ccept bz! reject b! ccept b! ccept b reject moooo reject Applictions in NLP? Grmmticlity (on the word level) Morphology (sub-word level) Orthogrphy (chrcter-level) Phonology (phoneme-level) FSA: How do they work? q 0 q 1 q 2 q 3 q 3 q 4 b! ACCEPT b! 23 24 4

FSA: How do they work? D-RECOGNIZE q 0 q 1 q 2 b!!! REJECT b! 25 26 Accept or Generte? Simple NLP with FSAs Forml lnguges re sets of strings Strings composed of symbols drwn from finite lphbet Finite-stte utomt define forml lnguges Without hving to enumerte ll the strings in the lnguge Two views of FSAs: Acceptors to tell you if string is in the lnguge Genertors to produce ll nd only the strings in the lnguge 27 28 Agend Introducing Non-Determinism Deterministic vs. Non-deterministic FSAs /b+!/ /b+!/ Epsilon (ε) trnsitions 29 30 5

Using NFSAs to Accept Strings ND-RECOGNIZE Wht does it men? Accept: there exists t lest one pth (need not be ll pths) Reject: no pths exist Generl pproches: Bckup: dd mrkers t choice points, then possibly revisit unexplored rcs t mrked choice point Look-hed: look hed in input to provide clues Prllelism: look t lterntives in prllel Recognition with NFSAs s serch through stte spce Agend holds (stte, tpe position) pirs 31 32 ND-RECOGNIZE Stte Orderings Stck (LIFO): depth-first Queue (FIFO): bredth-first 33 34 ND-RECOGNIZE: Exmple Wht s the point? NFSAs nd DFSAs re equivlent For every NFSA, there is equivlent DFSA (nd vice vers) Equivlence between regulr expressions nd FSA Esy to show with NFSAs Why use NFSAs? ACCEPT 35 36 6

Agend Finite-Stte Trnsducers (FSTs) A two-tpe utomton tht recognizes or genertes pirs of strings Think of n FST s n FSA with two symbol strings on ech rc One symbol string from ech tpe 37 38 Four-fold view of FSTs Agend As recognizer As genertor As trnsltor As set relter 39 40 Regulr Lnguge: Definition Regulr Lnguges: Strting Points Regulr lnguges/fsas s sets Set mth is regulr lnguge Σ ε, {} is regulr lnguge If L 1 nd L 2 re regulr lnguges, then so re: L 1 L 2 = {x y x L 1, y L 2 }, the conctention of L 1 nd L 2 L 1 L 2, the union or disjunction of L 1 nd L 2 L 1, the Kleene closure of L 1 41 42 7

Regulr Lnguges: Conctention Regulr Lnguges: Disjunction 43 44 Regulr Lnguges: Kleene Closure Agend: Summry 45 46 8