SlideShare uma empresa Scribd logo
1 de 19
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.

Mais conteúdo relacionado

Mais procurados

Lecture 1: Semantic Analysis in Language Technology
Lecture 1: Semantic Analysis in Language TechnologyLecture 1: Semantic Analysis in Language Technology
Lecture 1: Semantic Analysis in Language TechnologyMarina Santini
 
Lecture Notes-Finite State Automata for NLP.pdf
Lecture Notes-Finite State Automata for NLP.pdfLecture Notes-Finite State Automata for NLP.pdf
Lecture Notes-Finite State Automata for NLP.pdfDeptii Chaudhari
 
Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchySANUC2
 
Usage of regular expressions in nlp
Usage of regular expressions in nlpUsage of regular expressions in nlp
Usage of regular expressions in nlpeSAT Journals
 
Syntax analyzer
Syntax analyzerSyntax analyzer
Syntax analyzerahmed51236
 
Intro automata theory
Intro automata theory Intro automata theory
Intro automata theory Rajendran
 
natural language processing help at myassignmenthelp.net
natural language processing  help at myassignmenthelp.netnatural language processing  help at myassignmenthelp.net
natural language processing help at myassignmenthelp.netwww.myassignmenthelp.net
 
Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4DigiGurukul
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language ProcessingSaurabh Kaushik
 
Statistical machine translation
Statistical machine translationStatistical machine translation
Statistical machine translationHrishikesh Nair
 
Introduction to Sentiment Analysis
Introduction to Sentiment AnalysisIntroduction to Sentiment Analysis
Introduction to Sentiment AnalysisJaganadh Gopinadhan
 
Natural language processing
Natural language processingNatural language processing
Natural language processingKarenVacca
 
Knowledge based agents
Knowledge based agentsKnowledge based agents
Knowledge based agentsMegha Sharma
 
Conditional Random Fields - Vidya Venkiteswaran
Conditional Random Fields - Vidya VenkiteswaranConditional Random Fields - Vidya Venkiteswaran
Conditional Random Fields - Vidya VenkiteswaranWithTheBest
 

Mais procurados (20)

Lecture 1: Semantic Analysis in Language Technology
Lecture 1: Semantic Analysis in Language TechnologyLecture 1: Semantic Analysis in Language Technology
Lecture 1: Semantic Analysis in Language Technology
 
Lecture Notes-Finite State Automata for NLP.pdf
Lecture Notes-Finite State Automata for NLP.pdfLecture Notes-Finite State Automata for NLP.pdf
Lecture Notes-Finite State Automata for NLP.pdf
 
Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchy
 
Semantic analysis
Semantic analysisSemantic analysis
Semantic analysis
 
Usage of regular expressions in nlp
Usage of regular expressions in nlpUsage of regular expressions in nlp
Usage of regular expressions in nlp
 
Syntax analyzer
Syntax analyzerSyntax analyzer
Syntax analyzer
 
Intro automata theory
Intro automata theory Intro automata theory
Intro automata theory
 
natural language processing help at myassignmenthelp.net
natural language processing  help at myassignmenthelp.netnatural language processing  help at myassignmenthelp.net
natural language processing help at myassignmenthelp.net
 
Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4
 
Language models
Language modelsLanguage models
Language models
 
Treebank annotation
Treebank annotationTreebank annotation
Treebank annotation
 
NLP_KASHK:POS Tagging
NLP_KASHK:POS TaggingNLP_KASHK:POS Tagging
NLP_KASHK:POS Tagging
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Statistical machine translation
Statistical machine translationStatistical machine translation
Statistical machine translation
 
Introduction to Sentiment Analysis
Introduction to Sentiment AnalysisIntroduction to Sentiment Analysis
Introduction to Sentiment Analysis
 
Natural language processing
Natural language processingNatural language processing
Natural language processing
 
Knowledge based agents
Knowledge based agentsKnowledge based agents
Knowledge based agents
 
Classical Planning
Classical PlanningClassical Planning
Classical Planning
 
Conditional Random Fields - Vidya Venkiteswaran
Conditional Random Fields - Vidya VenkiteswaranConditional Random Fields - Vidya Venkiteswaran
Conditional Random Fields - Vidya Venkiteswaran
 
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
 

Semelhante a 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 studentsRosnaPHaroon
 
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
 
The Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxThe Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxssuser039bf6
 
closure properties of regular language.pptx
closure properties of regular language.pptxclosure properties of regular language.pptx
closure properties of regular language.pptxThirumoorthy64
 
Implementation of lexical analyser
Implementation of lexical analyserImplementation of lexical analyser
Implementation of lexical analyserArchana Gopinath
 
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.pdfTONY562
 
MidtermI-review.pptx
MidtermI-review.pptxMidtermI-review.pptx
MidtermI-review.pptxamara jyothi
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languagesSOMNATHMORE2
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languagesSOMNATHMORE2
 
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 ExpressionsDarío Garigliotti
 
INFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.pptINFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.pptLamhotNaibaho3
 
Theory of computing presentation
Theory of computing presentationTheory of computing presentation
Theory of computing presentationMd. Touhidur Rahman
 

Semelhante a 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
 

Mais de Hemantha Kulathilake

NLP_KASHK:Parsing with Context-Free Grammar
NLP_KASHK:Parsing with Context-Free Grammar NLP_KASHK:Parsing with Context-Free Grammar
NLP_KASHK:Parsing with Context-Free Grammar 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: 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 & BranchingHemantha 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
 
COM1407: Introduction to C Programming
COM1407: Introduction to C Programming COM1407: Introduction to C Programming
COM1407: Introduction to C Programming Hemantha Kulathilake
 
COM1407: Structured Program Development
COM1407: Structured Program Development COM1407: Structured Program Development
COM1407: Structured Program Development Hemantha Kulathilake
 

Mais de Hemantha Kulathilake (20)

NLP_KASHK:Parsing with Context-Free Grammar
NLP_KASHK:Parsing with Context-Free Grammar NLP_KASHK:Parsing with Context-Free Grammar
NLP_KASHK:Parsing with Context-Free Grammar
 
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:Minimum Edit Distance
NLP_KASHK:Minimum Edit DistanceNLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit Distance
 
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
 
COM1407: Introduction to C Programming
COM1407: Introduction to C Programming COM1407: Introduction to C Programming
COM1407: Introduction to C Programming
 
COM1407: Structured Program Development
COM1407: Structured Program Development COM1407: Structured Program Development
COM1407: Structured Program Development
 

Último

Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesRAJNEESHKUMAR341697
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxNadaHaitham1
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadhamedmustafa094
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 

Último (20)

Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 

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.