LING124 Finite state automata - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

LING124 Finite state automata

Description:

... subset of states that is reachable from the initial state in ... Refer to NFA, and for each symbol, list sets of states reachable from Si (call this list X) ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 30
Provided by: hahn7
Category:

less

Transcript and Presenter's Notes

Title: LING124 Finite state automata


1
LING124 Finite state automata
  • September 25, 2008

2
Class outline
  • Finite state automata (FSA)
  • Definition
  • FSA as an acceptor/recognizer
  • Deterministic vs. nondeterministic FSA
  • Determinization
  • Finite state transducers (FST)
  • Weighted finite state machines
  • Application in speech technology
  • Talk with Dr. Roula Svorou

9/30
3
Finite state automata (FSA)
  • An FSA is a quintuple ltS, so, F, S, dgt
  • S Set of states
  • so Initial state
  • F Set of final states
  • S Alphabet (a set of symbols)
  • d Transition relation
  • dS x S -gt S
  • dS x S U e -gt S, where e is a null symbol, for
    (nondeterministic) FSA with epsilon transition

4
Representing FSA
5
Language
  • FSA can function as a string acceptor
  • Start from the initial state
  • For each symbol of the input string, move to the
    state at the other end of the edge which is
    labeled by the symbol (transition)
  • FSA accepts a string if one arrives in a final
    state given the last symbol of the input string
  • The language accepted by an FSA is a set of all
    strings that is accepted by the FSA

6
Language (2)
  • More formally
  • An FSA accepts/recognizes a string w if there is
    a sequence of transitions from the initial state
    (s0) to a final state sF?F where the input
    symbols of w appear in the right order

where
7
Language Example
What are the strings that the FSA below accepts?
8
Deterministic vs. nondeterministic
  • Deterministic FSA (DFA)
  • A unique transition for a state-symbol pair
  • d S x S -gt S is a function rather than a
    relation
  • Nondeterministic FSA (NFA)
  • One or more transitions for a state-symbol pair
  • d can also be expressed as a function
  • d S x S -gt 2S, where 2S is a power set (the set
    of all subsets) of S
  • There is a DFA equivalent to any NFA
  • Two FSAs are equivalent if the languages they
    accept are the same

9
Example
10
Another example
11
Why interested in DFA?
  • A nondeterministic FSA (NFA) typically has less
    states and edges than its deterministic
    counterpart (DFA)
  • However, since there can be multiple paths for a
    given state-symbol pair in NFA, one must try (in
    the worst case) all of the alternatives to see if
    NFA does accept the input string -gt Efficiency in
    recognition

12
Determinization
  • Basic idea
  • A state-symbol pair is mapped to a subset of
    states in NFA (recall d S x S -gt 2S )
  • A state-symbol pair is mapped to a state in DFA
    (recall d S x S -gt S )
  • So we convert each subset of states that is
    reachable from the initial state in NFA into a
    state in DFA and redefine the transitions

13
Determinization algorithm
  • Create a queue (Q)
  • Create a node labeled s0 and put it in Q
  • While Q is not empty, take out its first subset
    (Si)
  • Refer to NFA, and for each symbol, list sets of
    states reachable from Si (call this list X)
  • For each subset (Sj) in X
  • Create a node labeled Sj and put it in Q, if it
    doesnt already exist
  • If any member of Sj is a final state in NFA, Sj
    becomes a final state
  • Add transition from Si to Sj

14
Determinization (1)
  • Create a queue (Q)
  • Create a node labeled s0 and put it in Q

15
Determinization (2)
  • While Q is not empty, take out its first subset
    (Si)
  • Refer to NFA, and for each symbol, list sets of
    states reachable from Si (call this list X)

Si 0
X d(0,a) d(0,a) 0,1 d(0,b) d(0,b)
0 d(0,c) d(0,c) 0
16
Determinization (3)
  • For each subset (Sj) in X
  • Create a node labeled Sj and put it in Q, if it
    doesnt already exist
  • If any member of Sj is a final state in NFA, Sj
    becomes a final state
  • Add transition from Si to Sj

X d(0,a) d(0,a) 0,1 d(0,b) d(0,b)
0 d(0,c) d(0,c) 0
Si 0 Sj 0,1
17
Determinization (4)
  • For each subset (Sj) in X
  • Create a node labeled Sj and put it in Q, if it
    doesnt already exist
  • If any member of Sj is a final state in NFA, Sj
    becomes a final state
  • Add transition from Si to Sj

X d(0,a) d(0,a) 0,1 d(0,b) d(0,b)
0 d(0,c) d(0,c) 0
Si 0 Sj 0
18
Determinization (5)
  • While Q is not empty, take out its first subset
    (Si)
  • Refer to NFA, and for each symbol, list sets of
    states reachable from Si (call this list X)

Si 0,1
X d(0,1,a) d(0,a) U d(1,a)
0,1 d(0,1,b) d(0,b) U d(1,b)
0,2 d(0,1,c) d(0,c) U d(1,c) 0
19
Determinization (6)
  • For each subset (Sj) in X
  • Create a node labeled Sj and put it in Q, if it
    doesnt already exist
  • If any member of Sj is a final state in NFA, Sj
    becomes a final state
  • Add transition from Si to Sj

X d(0,1,a) d(0,a) U d(1,a)
0,1 d(0,1,b) d(0,b) U d(1,b)
0,2 d(0,1,c) d(0,c) U d(1,c) 0
Si 0,1 Sj 0,1
20
Determinization (7)
  • For each subset (Sj) in X
  • Create a node labeled Sj and put it in Q, if it
    doesnt already exist
  • If any member of Sj is a final state in NFA, Sj
    becomes a final state
  • Add transition from Si to Sj

X d(0,1,a) d(0,a) U d(1,a)
0,1 d(0,1,b) d(0,b) U d(1,b)
0,2 d(0,1,c) d(0,c) U d(1,c) 0
Si 0,1 Sj 0,2
21
Determinization (8)
  • For each subset (Sj) in X
  • Create a node labeled Sj and put it in Q, if it
    doesnt already exist
  • If any member of Sj is a final state in NFA, Sj
    becomes a final state
  • Add transition from Si to Sj

X d(0,1,a) d(0,a) U d(1,a)
0,1 d(0,1,b) d(0,b) U d(1,b)
0,2 d(0,1,c) d(0,c) U d(1,c) 0
Si 0,1 Sj 0
22
Determinization (9)
  • While Q is not empty, take out its first subset
    (Si)
  • Refer to NFA, and for each symbol, list sets of
    states reachable from Si (call this list X)

Si 0,2
X d(0,2,a) d(0,a) U d(2,a)
0,1 d(0,2,b) d(0,b) U d(2,b)
0 d(0,2,c) d(0,c) U d(2,c) 0,3
23
Determinization (10)
  • For each subset (Sj) in X
  • Create a node labeled Sj and put it in Q, if it
    doesnt already exist
  • If any member of Sj is a final state in NFA, Sj
    becomes a final state
  • Add transition from Si to Sj

X d(0,2,a) d(0,a) U d(2,a)
0,1 d(0,2,b) d(0,b) U d(2,b)
0 d(0,2,c) d(0,c) U d(2,c) 0,3
Si 0,2 Sj 0,1
24
Determinization (11)
  • For each subset (Sj) in X
  • Create a node labeled Sj and put it in Q, if it
    doesnt already exist
  • If any member of Sj is a final state in NFA, Sj
    becomes a final state
  • Add transition from Si to Sj

X d(0,2,a) d(0,a) U d(2,a)
0,1 d(0,2,b) d(0,b) U d(2,b)
0 d(0,2,c) d(0,c) U d(2,c) 0,3
Si 0,2 Sj 0
25
Determinization (12)
  • For each subset (Sj) in X
  • Create a node labeled Sj and put it in Q, if it
    doesnt already exist
  • If any member of Sj is a final state in NFA, Sj
    becomes a final state
  • Add transition from Si to Sj

X d(0,2,a) d(0,a) U d(2,a)
0,1 d(0,2,b) d(0,b) U d(2,b)
0 d(0,2,c) d(0,c) U d(2,c) 0,3
Si 0,2 Sj 0,3
26
Determinization (13)
  • While Q is not empty, take out its first subset
    (Si)
  • Refer to NFA, and for each symbol, list sets of
    states reachable from Si (call this list X)

Si 0,3
X d(0,3,a) d(0,a) U d(3,a)
0,1 d(0,3,b) d(0,b) U d(3,b)
0 d(0,3,c) d(0,c) U d(3,c) 0
27
Determinization (14)
  • For each subset (Sj) in X
  • Create a node labeled Sj and put it in Q, if it
    doesnt already exist
  • If any member of Sj is a final state in NFA, Sj
    becomes a final state
  • Add transition from Si to Sj

X d(0,3,a) d(0,a) U d(3,a)
0,1 d(0,3,b) d(0,b) U d(3,b)
0 d(0,3,c) d(0,c) U d(3,c) 0
Si 0,3 Sj 0,1
28
Determinization (15)
  • For each subset (Sj) in X
  • Create a node labeled Sj and put it in Q, if it
    doesnt already exist
  • If any member of Sj is a final state in NFA, Sj
    becomes a final state
  • Add transition from Si to Sj

X d(0,3,a) d(0,a) U d(3,a)
0,1 d(0,3,b) d(0,b) U d(3,b)
0 d(0,3,c) d(0,c) U d(3,c) 0
Si 0,3 Sj 0
29
Good?
Write a Comment
User Comments (0)
About PowerShow.com