SlideShare a Scribd company logo
Finite-State Automata
K.A.S.H. Kulathilake
B.Sc.(Sp.Hons.)IT, MCS, Mphil, SEDA(UK)
Introduction
• The regular expression is more than just a
convenient meta-language for text searching.
• Symmetrically, any finite-state automaton can be
described with a regular expression.
• Second, a regular expression is one way of
characterizing a particular kind of formal
language called a regular language.
• Both regular expressions and finite-state
automata can be used to described regular
languages.
Introduction (Cont…)
• we defined the sheep language as any string
from the following (infinite) set:
/baa+!/
Introduction (Cont…)
• We represent the automaton as a directed graph: a finite set of
vertices (also called nodes), together with a set of directed links
between pairs of vertices called arcs.
• We’ll represent vertices with circles and arcs with arrows.
• The automaton has five states, which are represented by nodes in
the graph.
• State 0 is the start state which we represent by the incoming arrow.
• State 4 is the final state or accepting state, which we represent by
the double circle.
• It also has four transitions, which we represent by arcs in the graph.
Introduction (Cont…)
• The FSA can be used for recognizing (we also say accepting) strings
in the following way.
• The machine starts in the start state (q0), and iterates the following
process:
– Check the next letter of the input.
– If it matches the symbol on an arc leaving the current state, then cross
that arc, move to the next state, and also advance one symbol in the
input. I
– If we are in the accepting state (q4) when we run out of input, the
machine has successfully recognized an instance of sheeptalk.
• If the machine never gets to the final state, either because
– it runs out of input, or
– it gets some input that doesn’t match an arc, or
– if it just happens to get stuck in some non-final state, we say the
machine rejects or fails to accept an input.
Introduction (Cont…)
• We can also represent an automaton with a state-
transition table.
• We’ve marked state 4 with a colon to indicate that it’s a
final state (you can have as many final states as you want),
and the /0 indicates an illegal or missing transition.
Introduction (Cont…)
• More formally, a finite automaton is defined by
the following 5 parameters:
– 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 subset of Q
– d(q,i): The transition function or transition matrix
between states.
– Given a state qϵQ and an input symbol iϵΣ, δ(q,i)
returns a new state q’ϵQ.
– δ is thus a relation from Q ×Σ to Q;
Introduction (Cont…)
• E.g.
Q={q0 ,q1, q2, q3, q4 }
Σ = {a, b, !}
F = q4
δ(q,i) is defined by the transition table
Fail State
• The state machine will fail whenever there is no legal
transition for a given combination of state and input.
• The input abc will fail to be recognized since there is no
legal transition out of state q0 on the input a.
• Even if the automaton had allowed an initial a it would
have certainly failed on c, since c isn’t even in the
alphabet!
• We can think of these ‘empty’ elements in the table as
if they all pointed at one ‘empty’ state, which we might
call the fail state or sink state.
Fail State (Cont…)
• In a sense then, we could view any machine with
empty transitions as if we had augmented it with
a fail state, and drawn in all the extra arcs, so we
always had somewhere to go from any state on
any possible input.
• Just for completeness, the following is the
previous FSA with the fail state qF.
Formal Languages
• Let’s say for now that we don’t care how the machine makes this
decision; maybe it flips a coin.
• For now, we don’t care which exact string of above example we
generate, as long as it’s a string captured by the regular expression
for discussed previously.
• A formal language is a set of strings, each string composed of
symbols from a finite symbol-set called an alphabet (the same
alphabet used above for defining an automaton!).
• The alphabet for the above example is the set Σ ={a, b, !}.
• Given a model m (such as a particular FSA), we can use L(m) to
mean “the formal language characterized by m”.
• So the formal language defined by previous automaton m in is the
infinite set: L(m)={baa!, baaa!, baaaa!, baaaaa!, baaaaaa!,…..}
Formal Languages (Cont…)
• The usefulness of an automaton for defining a language is that it
can express an infinite set (such as this one above) in a closed form.
• Formal languages are not the same as natural languages, which are
the kind of languages that real people speak.
• In fact a formal language may bear no resemblance at all to a real
language.
• But we often use a formal language to model part of a natural
language, such as parts of the phonology, morphology, or syntax.
• The term generative grammar is sometimes used in linguistics to
mean a grammar of a formal language; the origin of the term is this
use of an automaton to define a language by generating all possible
strings.
FSA with Word Combination
• Suppose we wanted to build an FSA that modeled the
subpart of English dealing with amounts of money.
• Such a formal language would model the subset of
English consisting of phrases like ten cents, three
dollars, one dollar thirty-five cents and so on.
FSA with Word Combination (Cont…)
• We could now add cents and dollars to our
automaton.
Nondeterministic FSAs
• When we get to state 2, if we see an a we don’t know whether to
remain in state 2 or go on to state 3.
• Automata with decision points like this are called Non-deterministic
FSAs (or NFSAs).
• Recall by contrast that previous example specified a deterministic
automaton, i.e. one whose behavior during recognition is fully
determined by the state it is in and the symbol it is looking at.
• A deterministic automaton can be referred to as a DFSA.
Nondeterministic FSAs (Cont…)
• There is another common type of non-
determinism, which can be caused by arcs that
have no symbols on them (called ε-transitions).
• The automaton ε in following diagram defines the
exact same language as the last one, or our first
one, but it does it with an ε-transition.
Nondeterministic FSAs (Cont…)
• We interpret this new arc as follows:
• If we are in state 3, we are allowed to move to state 2
without looking at the input, or advancing our input
pointer.
• So this introduces another kind of non-determinism –
we might not know whether to follow the ε transition
or the ! arc.
Using an NFSA to Accept Strings
• If we want to know whether a string is an
instance of a particular corpus or not, and if we
use a non-deterministic machine to recognize it,
we might follow the wrong arc and reject it when
we should have accepted it.
• That is, since there is more than one choice at
some point, we might take the wrong choice.
• This problem of choice in non-deterministic
models will come up again and again as we build
computational models, particularly for parsing.
Using an NFSA to Accept Strings
(Cont…)
• There are three standard solutions to this
problem:
– Backup:
• Whenever we come to a choice point, we could put a marker
to mark where we were in the input, and what state the
automaton was in. Then if it turns out that we took the
wrong choice, we could back up and try another path.
– Look-ahead:
• We could look ahead in the input to help us decide which
path to take.
– Parallelism:
• Whenever we come to a choice point, we could look at every
alternative path in parallel.

More Related Content

What's hot

Context Free Grammar
Context Free GrammarContext Free Grammar
Context Free Grammar
Akhil Kaushik
 
Lecture: Automata
Lecture: AutomataLecture: Automata
Lecture: Automata
Marina Santini
 
NLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for EnglishNLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for English
Hemantha Kulathilake
 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite AutomataAdel Al-Ofairi
 
NFA & DFA
NFA & DFANFA & DFA
NFA & DFA
Akhil Kaushik
 
Machine translation
Machine translationMachine translation
Machine translation
mohamed hassan
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
Prof. Dr. K. Adisesha
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
Shiraz316
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
Toine Bogers
 
Lecture: Context-Free Grammars
Lecture: Context-Free GrammarsLecture: Context-Free Grammars
Lecture: Context-Free Grammars
Marina Santini
 
Syntactic analysis in NLP
Syntactic analysis in NLPSyntactic analysis in NLP
Syntactic analysis in NLP
kartikaVashisht
 
Machine Translation
Machine TranslationMachine Translation
Machine Translation
Skilrock Technologies
 
Formal language & automata theory
Formal language & automata theoryFormal language & automata theory
Formal language & automata theoryNYversity
 
Context free grammar
Context free grammar Context free grammar
Context free grammar
Mohammad Ilyas Malik
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
Akshaya Arunan
 
Context free languages
Context free languagesContext free languages
Context free languages
Jahurul Islam
 

What's hot (20)

Context Free Grammar
Context Free GrammarContext Free Grammar
Context Free Grammar
 
Lecture: Automata
Lecture: AutomataLecture: Automata
Lecture: Automata
 
Natural language processing
Natural language processingNatural language processing
Natural language processing
 
NLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for EnglishNLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for English
 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite Automata
 
NFA & DFA
NFA & DFANFA & DFA
NFA & DFA
 
Machine translation
Machine translationMachine translation
Machine translation
 
NLP
NLPNLP
NLP
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Lecture: Context-Free Grammars
Lecture: Context-Free GrammarsLecture: Context-Free Grammars
Lecture: Context-Free Grammars
 
Syntactic analysis in NLP
Syntactic analysis in NLPSyntactic analysis in NLP
Syntactic analysis in NLP
 
Machine Translation
Machine TranslationMachine Translation
Machine Translation
 
Formal language & automata theory
Formal language & automata theoryFormal language & automata theory
Formal language & automata theory
 
NLP
NLPNLP
NLP
 
Context free grammar
Context free grammar Context free grammar
Context free grammar
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Context free languages
Context free languagesContext free languages
Context free languages
 

Similar to NLP_KASHK:Finite-State Automata

Natural Language Processing Topics for Engineering students
Natural Language Processing Topics for Engineering studentsNatural Language Processing Topics for Engineering students
Natural Language Processing Topics for Engineering students
RosnaPHaroon
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computationprasadmvreddy
 
a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...
NALESVPMEngg
 
Finite automata
Finite automataFinite automata
Finite automata
ankitamakin
 
The Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxThe Theory of Finite Automata.pptx
The Theory of Finite Automata.pptx
ssuser039bf6
 
closure properties of regular language.pptx
closure properties of regular language.pptxclosure properties of regular language.pptx
closure properties of regular language.pptx
Thirumoorthy64
 
Lexical1
Lexical1Lexical1
Implementation of lexical analyser
Implementation of lexical analyserImplementation of lexical analyser
Implementation of lexical analyser
Archana Gopinath
 
TOC Introduction
TOC Introduction TOC Introduction
TOC Introduction
Thapar Institute
 
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdfAutomata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
TONY562
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
A. S. M. Shafi
 
MidtermI-review.pptx
MidtermI-review.pptxMidtermI-review.pptx
MidtermI-review.pptx
amara jyothi
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languages
SOMNATHMORE2
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languages
SOMNATHMORE2
 
Regular expression automata
Regular expression automataRegular expression automata
Regular expression automata
성욱 유
 
Patterns, Automata and Regular Expressions
Patterns, Automata and Regular ExpressionsPatterns, Automata and Regular Expressions
Patterns, Automata and Regular Expressions
Darío Garigliotti
 
INFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.pptINFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.ppt
LamhotNaibaho3
 
Theory of computing presentation
Theory of computing presentationTheory of computing presentation
Theory of computing presentation
Md. Touhidur Rahman
 

Similar to NLP_KASHK:Finite-State Automata (20)

Natural Language Processing Topics for Engineering students
Natural Language Processing Topics for Engineering studentsNatural Language Processing Topics for Engineering students
Natural Language Processing Topics for Engineering students
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computation
 
a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...
 
Finite automata
Finite automataFinite automata
Finite automata
 
Finite automata
Finite automataFinite automata
Finite automata
 
The Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxThe Theory of Finite Automata.pptx
The Theory of Finite Automata.pptx
 
closure properties of regular language.pptx
closure properties of regular language.pptxclosure properties of regular language.pptx
closure properties of regular language.pptx
 
Lexical1
Lexical1Lexical1
Lexical1
 
Implementation of lexical analyser
Implementation of lexical analyserImplementation of lexical analyser
Implementation of lexical analyser
 
TOC Introduction
TOC Introduction TOC Introduction
TOC Introduction
 
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdfAutomata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
MidtermI-review.pptx
MidtermI-review.pptxMidtermI-review.pptx
MidtermI-review.pptx
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languages
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languages
 
Regular expression automata
Regular expression automataRegular expression automata
Regular expression automata
 
intro.ppt
intro.pptintro.ppt
intro.ppt
 
Patterns, Automata and Regular Expressions
Patterns, Automata and Regular ExpressionsPatterns, Automata and Regular Expressions
Patterns, Automata and Regular Expressions
 
INFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.pptINFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.ppt
 
Theory of computing presentation
Theory of computing presentationTheory of computing presentation
Theory of computing presentation
 

More from Hemantha Kulathilake

NLP_KASHK:POS Tagging
NLP_KASHK:POS TaggingNLP_KASHK:POS Tagging
NLP_KASHK:POS Tagging
Hemantha Kulathilake
 
NLP_KASHK:Markov Models
NLP_KASHK:Markov ModelsNLP_KASHK:Markov Models
NLP_KASHK:Markov Models
Hemantha Kulathilake
 
NLP_KASHK:Smoothing N-gram Models
NLP_KASHK:Smoothing N-gram ModelsNLP_KASHK:Smoothing N-gram Models
NLP_KASHK:Smoothing N-gram Models
Hemantha Kulathilake
 
NLP_KASHK:Evaluating Language Model
NLP_KASHK:Evaluating Language ModelNLP_KASHK:Evaluating Language Model
NLP_KASHK:Evaluating Language Model
Hemantha Kulathilake
 
NLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit DistanceNLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit Distance
Hemantha Kulathilake
 
NLP_KASHK:Morphology
NLP_KASHK:MorphologyNLP_KASHK:Morphology
NLP_KASHK:Morphology
Hemantha Kulathilake
 
NLP_KASHK:Text Normalization
NLP_KASHK:Text NormalizationNLP_KASHK:Text Normalization
NLP_KASHK:Text Normalization
Hemantha Kulathilake
 
NLP_KASHK:Regular Expressions
NLP_KASHK:Regular Expressions NLP_KASHK:Regular Expressions
NLP_KASHK:Regular Expressions
Hemantha Kulathilake
 
NLP_KASHK: Introduction
NLP_KASHK: Introduction NLP_KASHK: Introduction
NLP_KASHK: Introduction
Hemantha Kulathilake
 
COM1407: File Processing
COM1407: File Processing COM1407: File Processing
COM1407: File Processing
Hemantha Kulathilake
 
COm1407: Character & Strings
COm1407: Character & StringsCOm1407: Character & Strings
COm1407: Character & Strings
Hemantha Kulathilake
 
COM1407: Structures, Unions & Dynamic Memory Allocation
COM1407: Structures, Unions & Dynamic Memory Allocation COM1407: Structures, Unions & Dynamic Memory Allocation
COM1407: Structures, Unions & Dynamic Memory Allocation
Hemantha Kulathilake
 
COM1407: Input/ Output Functions
COM1407: Input/ Output FunctionsCOM1407: Input/ Output Functions
COM1407: Input/ Output Functions
Hemantha Kulathilake
 
COM1407: Working with Pointers
COM1407: Working with PointersCOM1407: Working with Pointers
COM1407: Working with Pointers
Hemantha Kulathilake
 
COM1407: Arrays
COM1407: ArraysCOM1407: Arrays
COM1407: Arrays
Hemantha Kulathilake
 
COM1407: Program Control Structures – Repetition and Loops
COM1407: Program Control Structures – Repetition and Loops COM1407: Program Control Structures – Repetition and Loops
COM1407: Program Control Structures – Repetition and Loops
Hemantha Kulathilake
 
COM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & BranchingCOM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & Branching
Hemantha Kulathilake
 
COM1407: C Operators
COM1407: C OperatorsCOM1407: C Operators
COM1407: C Operators
Hemantha Kulathilake
 
COM1407: Type Casting, Command Line Arguments and Defining Constants
COM1407: Type Casting, Command Line Arguments and Defining Constants COM1407: Type Casting, Command Line Arguments and Defining Constants
COM1407: Type Casting, Command Line Arguments and Defining Constants
Hemantha Kulathilake
 
COM1407: Variables and Data Types
COM1407: Variables and Data Types COM1407: Variables and Data Types
COM1407: Variables and Data Types
Hemantha Kulathilake
 

More from Hemantha Kulathilake (20)

NLP_KASHK:POS Tagging
NLP_KASHK:POS TaggingNLP_KASHK:POS Tagging
NLP_KASHK:POS Tagging
 
NLP_KASHK:Markov Models
NLP_KASHK:Markov ModelsNLP_KASHK:Markov Models
NLP_KASHK:Markov Models
 
NLP_KASHK:Smoothing N-gram Models
NLP_KASHK:Smoothing N-gram ModelsNLP_KASHK:Smoothing N-gram Models
NLP_KASHK:Smoothing N-gram Models
 
NLP_KASHK:Evaluating Language Model
NLP_KASHK:Evaluating Language ModelNLP_KASHK:Evaluating Language Model
NLP_KASHK:Evaluating Language Model
 
NLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit DistanceNLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit Distance
 
NLP_KASHK:Morphology
NLP_KASHK:MorphologyNLP_KASHK:Morphology
NLP_KASHK:Morphology
 
NLP_KASHK:Text Normalization
NLP_KASHK:Text NormalizationNLP_KASHK:Text Normalization
NLP_KASHK:Text Normalization
 
NLP_KASHK:Regular Expressions
NLP_KASHK:Regular Expressions NLP_KASHK:Regular Expressions
NLP_KASHK:Regular Expressions
 
NLP_KASHK: Introduction
NLP_KASHK: Introduction NLP_KASHK: Introduction
NLP_KASHK: Introduction
 
COM1407: File Processing
COM1407: File Processing COM1407: File Processing
COM1407: File Processing
 
COm1407: Character & Strings
COm1407: Character & StringsCOm1407: Character & Strings
COm1407: Character & Strings
 
COM1407: Structures, Unions & Dynamic Memory Allocation
COM1407: Structures, Unions & Dynamic Memory Allocation COM1407: Structures, Unions & Dynamic Memory Allocation
COM1407: Structures, Unions & Dynamic Memory Allocation
 
COM1407: Input/ Output Functions
COM1407: Input/ Output FunctionsCOM1407: Input/ Output Functions
COM1407: Input/ Output Functions
 
COM1407: Working with Pointers
COM1407: Working with PointersCOM1407: Working with Pointers
COM1407: Working with Pointers
 
COM1407: Arrays
COM1407: ArraysCOM1407: Arrays
COM1407: Arrays
 
COM1407: Program Control Structures – Repetition and Loops
COM1407: Program Control Structures – Repetition and Loops COM1407: Program Control Structures – Repetition and Loops
COM1407: Program Control Structures – Repetition and Loops
 
COM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & BranchingCOM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & Branching
 
COM1407: C Operators
COM1407: C OperatorsCOM1407: C Operators
COM1407: C Operators
 
COM1407: Type Casting, Command Line Arguments and Defining Constants
COM1407: Type Casting, Command Line Arguments and Defining Constants COM1407: Type Casting, Command Line Arguments and Defining Constants
COM1407: Type Casting, Command Line Arguments and Defining Constants
 
COM1407: Variables and Data Types
COM1407: Variables and Data Types COM1407: Variables and Data Types
COM1407: Variables and Data Types
 

Recently uploaded

The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 

Recently uploaded (20)

The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 

NLP_KASHK:Finite-State Automata

  • 2. Introduction • The regular expression is more than just a convenient meta-language for text searching. • Symmetrically, any finite-state automaton can be described with a regular expression. • Second, a regular expression is one way of characterizing a particular kind of formal language called a regular language. • Both regular expressions and finite-state automata can be used to described regular languages.
  • 3. Introduction (Cont…) • we defined the sheep language as any string from the following (infinite) set: /baa+!/
  • 4. Introduction (Cont…) • We represent the automaton as a directed graph: a finite set of vertices (also called nodes), together with a set of directed links between pairs of vertices called arcs. • We’ll represent vertices with circles and arcs with arrows. • The automaton has five states, which are represented by nodes in the graph. • State 0 is the start state which we represent by the incoming arrow. • State 4 is the final state or accepting state, which we represent by the double circle. • It also has four transitions, which we represent by arcs in the graph.
  • 5. Introduction (Cont…) • The FSA can be used for recognizing (we also say accepting) strings in the following way. • The machine starts in the start state (q0), and iterates the following process: – Check the next letter of the input. – If it matches the symbol on an arc leaving the current state, then cross that arc, move to the next state, and also advance one symbol in the input. I – If we are in the accepting state (q4) when we run out of input, the machine has successfully recognized an instance of sheeptalk. • If the machine never gets to the final state, either because – it runs out of input, or – it gets some input that doesn’t match an arc, or – if it just happens to get stuck in some non-final state, we say the machine rejects or fails to accept an input.
  • 6. Introduction (Cont…) • We can also represent an automaton with a state- transition table. • We’ve marked state 4 with a colon to indicate that it’s a final state (you can have as many final states as you want), and the /0 indicates an illegal or missing transition.
  • 7. Introduction (Cont…) • More formally, a finite automaton is defined by the following 5 parameters: – 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 subset of Q – d(q,i): The transition function or transition matrix between states. – Given a state qϵQ and an input symbol iϵΣ, δ(q,i) returns a new state q’ϵQ. – δ is thus a relation from Q ×Σ to Q;
  • 8. Introduction (Cont…) • E.g. Q={q0 ,q1, q2, q3, q4 } Σ = {a, b, !} F = q4 δ(q,i) is defined by the transition table
  • 9. Fail State • The state machine will fail whenever there is no legal transition for a given combination of state and input. • The input abc will fail to be recognized since there is no legal transition out of state q0 on the input a. • Even if the automaton had allowed an initial a it would have certainly failed on c, since c isn’t even in the alphabet! • We can think of these ‘empty’ elements in the table as if they all pointed at one ‘empty’ state, which we might call the fail state or sink state.
  • 10. Fail State (Cont…) • In a sense then, we could view any machine with empty transitions as if we had augmented it with a fail state, and drawn in all the extra arcs, so we always had somewhere to go from any state on any possible input. • Just for completeness, the following is the previous FSA with the fail state qF.
  • 11. Formal Languages • Let’s say for now that we don’t care how the machine makes this decision; maybe it flips a coin. • For now, we don’t care which exact string of above example we generate, as long as it’s a string captured by the regular expression for discussed previously. • A formal language is a set of strings, each string composed of symbols from a finite symbol-set called an alphabet (the same alphabet used above for defining an automaton!). • The alphabet for the above example is the set Σ ={a, b, !}. • Given a model m (such as a particular FSA), we can use L(m) to mean “the formal language characterized by m”. • So the formal language defined by previous automaton m in is the infinite set: L(m)={baa!, baaa!, baaaa!, baaaaa!, baaaaaa!,…..}
  • 12. Formal Languages (Cont…) • The usefulness of an automaton for defining a language is that it can express an infinite set (such as this one above) in a closed form. • Formal languages are not the same as natural languages, which are the kind of languages that real people speak. • In fact a formal language may bear no resemblance at all to a real language. • But we often use a formal language to model part of a natural language, such as parts of the phonology, morphology, or syntax. • The term generative grammar is sometimes used in linguistics to mean a grammar of a formal language; the origin of the term is this use of an automaton to define a language by generating all possible strings.
  • 13. FSA with Word Combination • Suppose we wanted to build an FSA that modeled the subpart of English dealing with amounts of money. • Such a formal language would model the subset of English consisting of phrases like ten cents, three dollars, one dollar thirty-five cents and so on.
  • 14. FSA with Word Combination (Cont…) • We could now add cents and dollars to our automaton.
  • 15. Nondeterministic FSAs • When we get to state 2, if we see an a we don’t know whether to remain in state 2 or go on to state 3. • Automata with decision points like this are called Non-deterministic FSAs (or NFSAs). • Recall by contrast that previous example specified a deterministic automaton, i.e. one whose behavior during recognition is fully determined by the state it is in and the symbol it is looking at. • A deterministic automaton can be referred to as a DFSA.
  • 16. Nondeterministic FSAs (Cont…) • There is another common type of non- determinism, which can be caused by arcs that have no symbols on them (called ε-transitions). • The automaton ε in following diagram defines the exact same language as the last one, or our first one, but it does it with an ε-transition.
  • 17. Nondeterministic FSAs (Cont…) • We interpret this new arc as follows: • If we are in state 3, we are allowed to move to state 2 without looking at the input, or advancing our input pointer. • So this introduces another kind of non-determinism – we might not know whether to follow the ε transition or the ! arc.
  • 18. Using an NFSA to Accept Strings • If we want to know whether a string is an instance of a particular corpus or not, and if we use a non-deterministic machine to recognize it, we might follow the wrong arc and reject it when we should have accepted it. • That is, since there is more than one choice at some point, we might take the wrong choice. • This problem of choice in non-deterministic models will come up again and again as we build computational models, particularly for parsing.
  • 19. Using an NFSA to Accept Strings (Cont…) • There are three standard solutions to this problem: – Backup: • Whenever we come to a choice point, we could put a marker to mark where we were in the input, and what state the automaton was in. Then if it turns out that we took the wrong choice, we could back up and try another path. – Look-ahead: • We could look ahead in the input to help us decide which path to take. – Parallelism: • Whenever we come to a choice point, we could look at every alternative path in parallel.