SlideShare a Scribd company logo
1 of 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.

More Related Content

What's hot

ARTIFICIAL INTELLIGENCE
ARTIFICIAL INTELLIGENCEARTIFICIAL INTELLIGENCE
ARTIFICIAL INTELLIGENCE
Sabique Khan
 

What's hot (20)

Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
 
Natural Language processing Parts of speech tagging, its classes, and how to ...
Natural Language processing Parts of speech tagging, its classes, and how to ...Natural Language processing Parts of speech tagging, its classes, and how to ...
Natural Language processing Parts of speech tagging, its classes, and how to ...
 
Flat unit 3
Flat unit 3Flat unit 3
Flat unit 3
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
ARTIFICIAL INTELLIGENCE
ARTIFICIAL INTELLIGENCEARTIFICIAL INTELLIGENCE
ARTIFICIAL INTELLIGENCE
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Treebank annotation
Treebank annotationTreebank annotation
Treebank annotation
 
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
 
Challenges in nlp
Challenges in nlpChallenges in nlp
Challenges in nlp
 
Semantics analysis
Semantics analysisSemantics analysis
Semantics analysis
 
Machine Translation
Machine TranslationMachine Translation
Machine Translation
 
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
 
NLP_KASHK:Text Normalization
NLP_KASHK:Text NormalizationNLP_KASHK:Text Normalization
NLP_KASHK:Text Normalization
 
Syntax analyzer
Syntax analyzerSyntax analyzer
Syntax analyzer
 
Natural language-processing
Natural language-processingNatural language-processing
Natural language-processing
 
basics of compiler design
basics of compiler designbasics of compiler design
basics of compiler design
 
Natural Language Processing in AI
Natural Language Processing in AINatural Language Processing in AI
Natural Language Processing in AI
 
Turing machine
Turing machineTuring machine
Turing machine
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 

Similar to NLP_KASHK:Finite-State Automata

Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computation
prasadmvreddy
 

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

More from Hemantha Kulathilake (20)

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
 
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:N-Grams
NLP_KASHK:N-GramsNLP_KASHK:N-Grams
NLP_KASHK:N-Grams
 
NLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit DistanceNLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit Distance
 
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
 

Recently uploaded

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 

Recently uploaded (20)

Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
 
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 ...
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
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
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 

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.