Download Presentation
## Finite-State Automata

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Finite-State Automata**Shallow Processing Techniques for NLP Ling570 October 5, 2011**Roadmap**• Finite-state automata variants • Non-deterministic Finite-State Automata (NFA) • Probabilistic Finite-State Automata (PFSA) • Finite-State Transducers (FST) • Intro • CARMEL**FSAs Formally**• A Finite-State Automaton (FSA) is a 5-tuple: • A set of states Q {q0,q1,q2,q3,q4} • A finite alphabet Σ {b,a,!} • A state state q0 • A set of accepting states {q4} • A transition function Q x Σ Q**Non-deterministic Finite-State Automata**• Deterministic FSA: • Given current state x input, at most one legal transition**Non-deterministic Finite-State Automata**• Deterministic FSA: • Given current state x input, at most one legal transition • Sources of non-determinism in NFA**Non-deterministic Finite-State Automata**• Deterministic FSA: • Given current state x input, at most one legal transition • Sources of non-determinism in NFA • More than one transition for qi x a**Non-deterministic Finite-State Automata**• Deterministic FSA: • Given current state x input, at most one legal transition • Sources of non-determinism in NFA • More than one transition for qi x a • ε-transitions • Transitions that consume no input**Non-deterministic Finite-State Automata**• Deterministic FSA: • Given current state x input, at most one legal transition • Sources of non-determinism in NFA • More than one transition for qi x a • ε-transitions • Transitions that consume no input • Multiple start states • Transitions: • Q x (ΣU ε) 2S**Sheeptalk NFA**• Multiple choice:**Sheeptalk NFA**• Multiple choice: • ε-transitions**NFA & DFA**• What is the relationship b/t NFAs and DFAs?**NFA & DFA**• What is the relationship b/t NFAs and DFAs? • NFAs and DFAs are equivalent • Accept same languages**NFA & DFA**• What is the relationship b/t NFAs and DFAs? • NFAs and DFAs are equivalent • Accept same languages • Standard transformation from NFA to DFA: • Create new state for each equivalence class in NFA**NFA & DFA**• What is the relationship b/t NFAs and DFAs? • NFAs and DFAs are equivalent • Accept same languages • Standard transformation from NFA to DFA: • Create new state for each equivalence class in NFA • If NFA has N states, up to 2N states in DFA**NFA & DFA**• What is the relationship b/t NFAs and DFAs? • NFAs and DFAs are equivalent • Accept same languages • Standard transformation from NFA to DFA: • Create new state for each equivalence class in NFA • If NFA has N states, up to 2N states in DFA • Why use both?**Managing Non-Determinism**• Approaches to non-determinism**Managing Non-Determinism**• Approaches to non-determinism • Backup/backtracking: • At choice points, mark state, input • If fail, return and try alternative**Managing Non-Determinism**• Approaches to non-determinism • Backup/backtracking: • At choice points, mark state, input • If fail, return and try alternative • Look-ahead: • Look ahead to see which choice to take**Managing Non-Determinism**• Approaches to non-determinism • Backup/backtracking: • At choice points, mark state, input • If fail, return and try alternative • Look-ahead: • Look ahead to see which choice to take • Parallelism: • At choice points, consider all paths in parallel • Basically the NFA DFA conversion process**Recognition in NFAs**• Two standard approaches:**Recognition in NFAs**• Two standard approaches: • Transformation: • Convert NFA DFA • Perform standard DFA recognition**Recognition in NFAs**• Two standard approaches: • Transformation: • Convert NFA DFA • Perform standard DFA recognition • Search: • Explicitly model recognition as state-space search • Perform backtracking as necessary**Recognition in NFA**• For strings in the language:**Recognition in NFA**• For strings in the language: • There exists some state sequence leading to a final state**Recognition in NFA**• For strings in the language: • There exists some state sequence leading to a final state • Not all paths necessarily lead to an accept state • For strings not in the language:**Recognition in NFA**• For strings in the language: • There exists some state sequence leading to a final state • Not all paths necessarily lead to an accept state • For strings not in the language: • No paths lead to an accept state**NFA Recognition as Search**• Search problem:**NFA Recognition as Search**• Search problem: • Start search-state • (start node, beginning of input)**NFA Recognition as Search**• Search problem: • Start search-state • (start node, beginning of input) • Goal test • (final node, end of input)**NFA Recognition as Search**• Search problem: • Start search-state • (start node, beginning of input) • Goal test • (final node, end of input) • Successor function • Transitions**NFA Recognition as Search**• Search problem: • Start search-state • (start node, beginning of input) • Goal test • (final node, end of input) • Successor function • Transitions • Path cost**NFA Recognition as Search**• Search problem: • Start search-state • (start node, beginning of input) • Goal test • (final node, end of input) • Successor function • Transitions • Path cost • Use standard search algorithms • e.g. Depth-first, breadth first, A***Equivalences and Operations**• FSAs equivalent to Regular Languages (Regex, etc) • Can be shown by induction • Demonstrate primitive regex ops imitated by automata**Equivalences and Operations**• FSAs equivalent to Regular Languages (Regex, etc) • Can be shown by induction • Demonstrate primitive regex ops imitated by automata**Equivalences and Operations**• FSAs equivalent to Regular Languages (Regex, etc) • Can be shown by induction • Demonstrate primitive regex ops imitated by automata**Equivalences and Operations**• FSAs equivalent to Regular Languages (Regex, etc) • Can be shown by induction • Demonstrate primitive regex ops imitated by automata**Equivalences and Operations**• FSAs equivalent to Regular Languages (Regex, etc) • Can be shown by induction • Demonstrate primitive regex ops imitated by automata • E.g. Concatenation**Equivalences and Operations**• FSAs equivalent to Regular Languages (Regex, etc) • Can be shown by induction • Demonstrate primitive regex ops imitated by automata • E.g. Concatenation**Equivalences and Operations**• Closure: • Union: