0% found this document useful (0 votes)
138 views

Regular Expressions & Fsas

- Regular expressions can be represented as finite state automata (FSA), which can be either deterministic (DFSA) or non-deterministic (NFSA). Any NFSA can be converted to an equivalent DFSA. - An FSA represents a regular language using states, transitions between states based on input symbols, a start state, and accepting/final states. - FSAs can be implemented using transition tables or search algorithms like depth-first or breadth-first search to process input strings. Regular languages have properties of closure under operations and are equivalent to languages recognized by FSAs.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
138 views

Regular Expressions & Fsas

- Regular expressions can be represented as finite state automata (FSA), which can be either deterministic (DFSA) or non-deterministic (NFSA). Any NFSA can be converted to an equivalent DFSA. - An FSA represents a regular language using states, transitions between states based on input symbols, a start state, and accepting/final states. - FSAs can be implemented using transition tables or search algorithms like depth-first or breadth-first search to process input strings. Regular languages have properties of closure under operations and are equivalent to languages recognized by FSAs.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 6

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İL711 Natural Language Processing 1
A DFSA and A NFSA

a b
a a,b
0 1 0 1

b b

A NFSA: a*(a|b)b*
A DFSA : a | b+

BİL711 Natural Language Processing 2


Formal Definition of Finite-State Automata
• FSA is Q x  x q0 x F x 

• Q: a finite set of N states q0, q1, … qN


• : a finite input alphabet of symbols
• q0: 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İL711 Natural Language Processing 3


Transition Tables for FSAs
a b a b €
1 2 3 1 1,2 2 *
2 * * 2 * 2 *

3 * 3

A NFSA
A DFSA

• We can use transition tables to show FSAs.

BİL711 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 b
1,aaab
a,b
1 2
2,aab 1,aab
fail
2,ab 1,ab
Tape: aaab fai
l 2,b 1,b

2,- 2,-
success success
BİL711 Natural Language Processing 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İL711 Natural Language Processing 6

You might also like