Regular Expressions FSAs Any regular expression can be
Regular Expressions & FSAs • Any regular expression can be realized as a finite state automaton (FSA) • There are two kinds of FSAs – Deterministic (DFSAs) – Non-deterministic (NFSAs) • Any NFSA can be converted into a corresponding DFSA. • A FSA (a regular expression) represents a regular language. Regular Expressions Finite Automata Regular Languages BİL 711 Natural Language Processing 1
A DFSA and A NFSA a 0 a 1 b 0 b a, b 1 b 2 A NFSA: a*(a|b)b* A DFSA : a | b+ BİL 711 Natural Language Processing 2
Formal Definition of Finite-State Automata • FSA is Q x x q 0 x F x • • • Q: a finite set of N states q 0, q 1, … q. N : a finite input alphabet of symbols q 0: the start state F: the set of final states -- F is a subset of Q (q, i): transition function – DFSA : There is exactly one arc leaving a state q with a symbol a. There is no arc with the empty string. – NFSA : There can be more than one arc leaving a state q with a symbol a. There can be arcs with empty string. BİL 711 Natural Language Processing 3
Transition Tables for FSAs a b 1 2 3 2 * * 3 a b € 1 1, 2 2 * 2 * A NFSA A DFSA • We can use transition tables to show FSAs. BİL 711 Natural Language Processing 4
Implementation of FSAs • To implement DFSA is simpler. • To implement NFSAs, we need a search algorithm. – Depth-first – be careful about infinite loops – Breadth-first Search Space a 1 b a, b 2 1, aaab 2, aab fail Tape: aaab BİL 711 Natural Language Processing 1, aab 2, ab fai l 1, ab 2, b 1, b 2, success 5
Regular Languages • Operations on regular languages and FSAs: – concatenation, closure, union • Properties of regular languages – closed under concatenation, union, disjunction, intersection, difference, complementation, reversal, closure. • Equivalent to finite-state automata. BİL 711 Natural Language Processing 6
- Slides: 6