Module 2 - Notes
Module 2 - Notes
MODULE 2
SYLLABUS:
Word Level Analysis: Regular Expressions, Finite-State Automata,
Morphological Parsing, Spelling Error Detection and Correction, Words and
Word Classes, Part-of Speech Tagging.
Syntactic Analysis: Context-Free Grammar, Constituency, Top-down and
Bottom-up Parsing, CYK Parsing.
_________________________________________________________________
Contents
2.1 Regular Expressions..........................................................................................2
2.1.1 Case Sensitivity in Regular Expressions ............................................... 3
2.1.2 Special Operators in Regular Expressions ............................................. 3
2.1.3 Anchors in Regular Expressions............................................................ 4
2.1.4 Wildcard Character (.) .......................................................................... 4
2.1.5 Regular Expressions for Validation ....................................................... 4
2.2 Finite-State Automata ..................................................................................5
2.3 Morphological Parsing ......................................................................................9
2.3.1 From the Surface to the Intermediate Form ......................................... 11
2.3.2 From the Intermediate Form to the Morphological Structure ............. 12
2.4 Spelling Error Detection and Correction ........................................................14
2.4.1 Minimum Edit Distance ....................................................................... 16
2.5 Part-Of-Speech Tagging .................................................................................18
2.5.1 Rule Based Tagger ............................................................................... 21
2.5.2 Stochastic Tagger ................................................................................ 22
2.5.3 Hybrid Taggers .................................................................................... 25
2.6 Context-Free Grammar ...................................................................................28
2.6.1 Phrase Level Constructions ................................................................. 28
2.6.2 Sentence Level Constructions ............................................................. 33
2.7 Parsing.............................................................................................................35
2.7.1 Top-Down Parsing ............................................................................... 36
2.7.2 Bottom-up Parsing ............................................................................... 39
1|Page
MODULE 2 NLP [BAI601]
____________________LECTURE 07______________________
We have used simplified forms of regular expressions, such as the file search
patterns used by MS DOS, e.g., dir*.txt. The use of regular expressions in
computer science was made by a Unix-based editor, ‘ed’.Perl was the first
language that provided integrated support for regular expressions. It used a
slash around each regular expression.
Ex: /supernova/ denotes the set that contains the string ‘supernova’.
Character Classes:
Character classes define sets of characters to match specific patterns.
Regex Pattern Explanation Example Matches
[abcd] Matches any one of the given "a", "b", "c", "d"
characters
[^abcd] Matches any character except the "e", "f", "g"
given ones
[a-z] Matches any lowercase letter "m", "p", "z"
from a to z
[A-Z] Matches any uppercase letter "K", "X"
from A to Z
[0-9] Matches any digit from 0 to 9 "3", "7", "9"
3|Page
MODULE 2 NLP [BAI601]
Regular expressions can be used to validate structured input like email addresses.
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Explanation:
Examples:
4|Page
MODULE 2 NLP [BAI601]
REVIEW QUESTIONS
____________________LECTURE 10______________________
2.2 Finite-State Automata
Finite state automaton has a mathematical model which is quite
understandable; data can be represented in a compacted form using finite state
automaton and it allows automatic compilation of system components.
Finite state automata (deterministic and non-deterministic finite automata)
provide decisions regarding the acceptance and rejection of a string while
transducers provide some output for a given input. Thus the two machines are
quite useful in language processing tasks. Finite state automata are useful in
deciding whether a given word belongs to a particular language or not.
The term automata, derived from the Greek word “αὐτόματα” meaning “self-
acting”, is the plural of automaton which may be defined as an abstract self-
propelled computing device that follows a predetermined sequence of
operations automatically.
An automaton having a finite number of states is called a Finite Automaton
(FA) or Finite State automata (FSA).
Mathematically, an automaton can be represented by 5-tuple (Q, Σ, δ, q0, F),
where −
► Q is a finite set of states.
► Σ is a finite set of symbols, called the alphabet of the automaton
► δ is the transition function
► q0 is the initial state from where any input is processed (q0 ∈ Q)
► F is a set of final state/states of Q (F ⊆ Q)
A finite automaton can be deterministic or non-deterministic. In a non-
deterministic automaton, more than one transition out of a state is possible for
the same input symbol.
Example: Suppose ∑= {a, b}, the set of states = {q0, q1, q2, q3, q4} with q0
5|Page
MODULE 2 NLP [BAI601]
being the start state and q4 the final state, we have the following rules of
transition:
1. From state q0 and with input a, go to state q1.
2. From state q1 and with input b, go to state q2.
3. From state q1 and with input c, go to state q3.
4. From state q2 and with input b, go to state q4.
5. From state q3 and with input b, go to state q4.
This finite state automaton is shown as a directed graph called transition
diagram as shown in figure 2.1. The nodes in this diagram correspond to the
states and the arcs to transitions. The arcs are labelled with inputs. The final
state is represented by a double circle. There is exactly one transition leading
out of each state. Hence this automaton is deterministic.
6|Page
MODULE 2 NLP [BAI601]
7|Page
MODULE 2 NLP [BAI601]
Consider a language with all strings containing only as and bs and ending with
baa. We can specify this language by the regular expression /{a|b)*baa$/. The
NFA implementing this regular expression is shown in figure 2.3.
Two automata that define the same language are said to be equivalent. An NFA
can be converted to an equivalent DFA and vice versa. The equivalent DFA for
the NFA shown in Figure 2.3 is shown in Figure 2.4.
8|Page
MODULE 2 NLP [BAI601]
There are two broad classes of morphemes: stems and affixes. The stem is the
main morpheme, i.e., the morpheme that contains the central meaning. Affixes
modify the meaning given by the stem. Affixes are divided into prefixes, suffix,
infix, and circumfix. Prefixes are morphemes which appear before a stem, and
suffixes are morphemes applied to the end of the stem. Circumfixes are morphemes
that may be applied to either end of the stem while infixes are morphemes that
appear inside a stem.
There are three main ways of word formation: Inflection, Derivation and
compounding. In inflection a root word is combined with a grammatical
morpheme to yield a word of the same class as the original stem. Derivation
combines a word stem with a grammatical morpheme to yield a word belonging to
a different class. E.g formation of the noun computation from the verb compute.
The formation of a noun from a verb or adjective is called normalization.
Compounding is the process of merging two or more words to form a new word.
For example ,personal computer, desktop, overlook.
Morphological parsing takes as input the inflected surface form of each word in a
text. As output it produces the parsed form consisting of a canonical form(or
lemma) of the word and set of tags showing its syntactic category and
morphological characteristics. Ex possible part of speech and/or inflectional
properties. Morphological generation is the inverse of this process.
i. Lexicon: A lexicon lists stems and affixes together with basic information
about them.
ii. Morphotactic: It is basically the model of morpheme ordering. In other
sense, the model explains which classes of morphemes can follow other
classes of morphemes inside a word. For example, the morphotactic fact is
9|Page
MODULE 2 NLP [BAI601]
that the English plural morpheme always follows the noun rather than
preceding it.
iii. Orthographic rules: These spelling rules are used to model the changes
occurring in a word. For example, the rule of converting y to ie in word like
city+s = cities not citys.
The goal of morphological parsing is to find out what morphemes a given word is
built from. For example, a morphological parser should be able to tell us that the
word cats is the plural form of the noun stem cat, and that the word mice is the
plural form of the noun stem mouse. So, given the string cats as input, a
morphological parser should produce an output that looks like cat N PL. Here are
some more examples:
To get from the surface form of a word to its morphological analysis, we are
going to proceed in two steps. First, we are going to split the words up into its
possible components. So, we will make cat + s out of cats, using + to indicate
morpheme boundaries. In this step, we will also take spelling rules into account,
so that there are two possible ways of splitting up foxes, namely foxe + s and fox
+ s. The first one assumes that foxe is a stem and s the suffix, while the second one
assumes that the stem is fox and that the e has been introduced due to the spelling
rule that we saw above.
In the second step, we will use a lexicon of stems and affixes to look up the
categories of the stems and the meaning of the affixes. So, cat + s will get mapped
to cat NP PL, and fox + s to fox N PL. We will also find out now that foxe is not a
legal stem. This tells us that splitting foxes into foxe + s was actually an incorrect
way of splitting foxes, which should be discarded. But note that for the word houses
splitting it into house + s is correct.
10 | P a g e
MODULE 2 NLP [BAI601]
Here is a picture illustrating the two steps of our morphological parser with some
examples.
Let's see how this transducer deals with some of our examples. The following
graphs show the possible sequences of states that the transducer can go through
given the surface forms cats and foxes as input.
11 | P a g e
MODULE 2 NLP [BAI601]
Now, we want to take the intermediate form that we produced in the previous
section and map it to the underlying form. The input that this transducer must
accept is of one of the following forms:
In the first case, the transducer must map all symbols of the stem to themselves
and then output N and SG. In the second case, it maps all symbols of the stem to
themselves, but then outputs N and replaces PL with s. In the third case, it does the
same as in the first case. Finally, in the fourth case, the transducer should map the
irregular plural noun stem to the corresponding singular stem (e.g. mice to mouse)
and then it should add N and PL. So, the general structure of this transducer looks
like this:
12 | P a g e
MODULE 2 NLP [BAI601]
What still needs to be specified is how exactly the parts between state 1 and states
2,3, and 4 respectively look like. Here, we need to recognize noun stems and decide
whether they are regular or not. We do this by encoding a lexicon in the following
way. The transducer part that recognizes cat, for instance, looks like this:
And the transducer part mapping mice to mouse can be specified as follows:
Plugging these (partial) transducers into the transducer given above we get a
transducer that checks that input has the right form and adds category and numerus
information.
REVIEW QUESTIONS
13 | P a g e
MODULE 2 NLP [BAI601]
____________________LECTURE 11______________________
2.4 Spelling Error Detection and Correction
In computer based information systems, errors of typing and spelling constitute a
very common source of variation between strings. These errors have been widely
investigated. All investigations agree that single character omission, insertion
,substitution and reversal are the most common typing mistakes. In an early
investigation, Damearu(1964) reported that over 80% of the typing errors were
single error misspellings:
1) Substitution of a single letter
2) omission of a single letter
3) Insertion of a single letter and
4) Transposition of two adjacent letters.
The most common type of single character error was substitution, followed by
omission of a letter and then insertion of a letter. Single character omission occurs
when a single character is missed (deleted), e.g., when 'concept' is accidentally
typed as `concpt'. Insertion error refers to the presence of an extra character in a
word, e.g. when 'error' is misspell as ‘errorn'. Substitution error occurs when a
wrong letter is typed in place of the right one, as in `errpr', where `p' appears in
place of 'o'. Reversal refers to a situation in which the sequence of characters is
reversed, e.g., `aer' instead of 'are'. This is also termed transposition.
Optical character recognition (OCR) and other automatic reading devices introduce
errors of substitution, deletion, and insertion but not of reversal. OCR errors are
usually grouped into five classes: substitution, multi-substitution(or framing),
space deletion or insertion, and failures. Unlike substitution errors made in typing,
OCR substitution errors are caused due to visual similarity such as c-->e, r-->n.
The same is true for multi-substitution, e.g., m—>rn. Failure occurs when the OCR
algorithm fails to select a letter with sufficient accuracy. The frequency and type
of errors are characteristics of the device. These errors can be corrected using
'context' or by using linguistic structures.
Unlike typing errors, spelling errors are mainly phonetic, where the misspell word
is pronounced in the same way as the correct word. Phonetic errors are harder to
set right because they distort the word by more than a single insertion, deletion, or
substitution. Phonetic variations are common in transliteration. For example,
spelling errors belong to one of two distinct categories: non-word errors and
real word errors. When an error results in a word that does not appear in each
14 | P a g e
MODULE 2 NLP [BAI601]
15 | P a g e
MODULE 2 NLP [BAI601]
Edit distance can be viewed as a string alignment problem. By aligning two strings,
we can measure the degree to which they match. There may be more than one
possible alignment between two strings. The best possible alignment corresponds
to the minimum edit distance between the strings. The alignment shown here,
between tutor and tumour has a distance of 2.
A dash in the upper string indicates insertion. A substitution occurs when the two
alignment symbols do not match (shown in bold). We can associate a weight or
cost with each operation. The Levensthein distance between two sequences is
obtained by assigning a unit cost to each operation. Another possible alignment for
these sequences is:
which has a cost of 3. We already have a better alignment than this one.
The problem of finding minimum edit distance seems quite simple but in fact is
not so. A choice that seems good initially might lead to problems later. Dynamic
Programming Algorithm be quite useful for finding minimum edit distance
between two sequences. Dynamic programming refers to a class of algorithms that
apply a table-driven approach to solving problems by combining solutions to sub-
problems. The dynamic programming algorithm for minimum edit distance is
implemented by creating an edit distance matrix. This matrix has one row for each
symbol in the source string and one column for each matrix in the target string.
The (i,j)th cell in this matrix represents the distance between the first i character of
the source and the first j character of the target string. Each cell can be computed
as a simple function of its surrounding cells. Thus, by starting at the beginning of
the matrix, it is possible to fill each entry iteratively. The value in each cell is
computed in terms of three possible paths:
16 | P a g e
MODULE 2 NLP [BAI601]
The substitution will be 0 if the ith character in the source matches with jth character
in the target. The minimum edit distance algorithm is given below:
for i = 0 to m do
dist[i,0] ← i
for j = 0 to n do
dist[0,j] ← j
for i = 0 to m do
for j = 0 to n do
dist[i,j] ← min(
dist[i-1,j] + insert_cost,
dist[i-1,j-1] + subst_cost(Xᵢ, Yⱼ),
dist[i,j-1] + delete_cost
)
How the algorithm computes the minimum edit distance between tutor and tumour
is shown in Figure 2.5.
17 | P a g e
MODULE 2 NLP [BAI601]
REVIEW QUESTIONS
1. What are the three basic edit operations used in computing minimum edit
distance?
2. What is the minimum edit distance between two identical strings?
3. Which algorithm is commonly used to compute the minimum edit distance
between two strings?
4. In minimum edit distance, what does substitution operation represent?
____________________LECTURE 12______________________
The collection of tags used by a particular tagger is called a tag set. Most part-of-
speech tag sets make use of the same basic categories, i.e., noun, verb, adjective,
and prepositions. However, tag sets differ in how they define categories and how
finely they divide words into categories. For example, both eat and eats might be
tagged as a verb in one tag set but assigned distinct tags in another tag set. In
addition, most tag sets capture morphosyntactic information such as
singular/plural, number, gender, tense, etc.
The word eat has a distinct grammatical form in each of these four sentences. Eat
is the base form, ate its past tense and the form eats requires a third person singular
18 | P a g e
MODULE 2 NLP [BAI601]
subject. Similarly eaten is the past participle form and cannot occur in another
grammatical context. It is required after have or has. Thus the following sentences
are ungrammatical:
The Penn Treebank tag set contains 45 tags while C7 uses [Link] a language like
English, which is not morphologically rich, the C7 tagset is too big. The tagging
process would yield too many mis tagged words and the result would have to be
manually corrected. The larger the tag set, the greater the information captured
about a linguistic context. The task of tagging becomes complicated and requires
manual correction.
A tag set that uses just one tag to denote all the verbs will assign identical tags to
all the forms of a verb. The Penn Treebank tag captures finer distinction by
assigning distinct tags to distinct grammatical forms of a verb.
Tags assigned to the four different forms of the word eat according to this tag set
are shown below.
eat → VB
ate → VBD
19 | P a g e
MODULE 2 NLP [BAI601]
eaten → VBN
eats → VBP
• Example 1: "The quick brown fox jumps over the lazy dog.”
20 | P a g e
MODULE 2 NLP [BAI601]
Part of speech tagging methods fall under the three general categories:
21 | P a g e
MODULE 2 NLP [BAI601]
Approximating the tag history using only the two previous tags, the transition
probability, P(T), becomes
Stochastic models have the advantage of being accurate and language independent.
Most stochastic taggers have an accuracy of 96-97%. The accuracy seems to be
quite high but it should be noted that this is measured as a percentage of words. An
accuracy of 96%means that for a sentence containing 20 words, the error rate per
sentence will be 1-0.9620=56%. This corresponds to approximately one word per
sentence. One of the drawbacks of stochastic taggers is that they require a manually
tagged corpus for training.
Example: Consider the sentence “The bird can fly” and the tag sequence DT NNP
MD VB
23 | P a g e
MODULE 2 NLP [BAI601]
Exercise:
"She plays football."
Two possible POS tag sequences:
24 | P a g e
MODULE 2 NLP [BAI601]
Figure 2.6 illustrates the TBL process. Like most HMM taggers, TBL is also a
supervised learning technique.
25 | P a g e
MODULE 2 NLP [BAI601]
The steps involved in the TBL tagging algorithm are shown below:
The input to Brill's TBL tagging algorithm is a tagged corpus and a lexicon (with
most frequent information as indicated in the training corpus). The initial state
annotator uses the lexicon to assign the most likely tag to each word as the start
state. An ordered set of transformation rules are applied sequentially. The rule that
results in the most improved tagging is selected. A manually tagged corpus is used
as reference for truth. The process is iterated until some stopping criterion is
reached, such as when no significant information is achieved over the previous
26 | P a g e
MODULE 2 NLP [BAI601]
iteration. At each iteration, the transformation that results in the highest score is
selected. The output of the algorithm is a ranked list of learned transformation that
transform the initial tagging close to the correct tagging. New text can then be
annotated by first assigning the most frequent tag and then applying the ranked list
of learned transformations in order.
Observation
• The most likely tag for "fish" is NNP, so both sentences are tagged with
NNP.
• This is incorrect in the second sentence.
Applied Transformation
• Sentence 2 is corrected:
27 | P a g e
MODULE 2 NLP [BAI601]
REVIEW QUESTIONS
____________________LECTURE 13______________________
The rule A → α says that constituent A can be rewritten as α. This is also called
the phrase structure rule.
28 | P a g e
MODULE 2 NLP [BAI601]
This is called the substitution test. Consider the sentence Hena reads a book. We
can substitute several other phrases:
We can easily identify the constituents that can be replaced for each other in these
sentences. These are Hena, she, and Those girls and a book, a storybook, and a
comic book. These are the words that form a phrase. In linguistics, such
constituents represent a paradigmatic relationship. Elements that can substitute
each other in certain syntactic positions are said to be members of one paradigm.
Phrase types are named after their head, which is the lexical category that
determines the properties of the phrase. Thus, if the head is a noun, the phrase is
called a noun phrase, if the head is a verb, the phrase is called a verb phrase and so
on for other lexical categories like adjective and preposition.
• NP → Pronoun
• NP → Det Noun
29 | P a g e
MODULE 2 NLP [BAI601]
• NP → Noun
• NP → Adj Noun
• NP → Det Adj Noun
We can combine all these rules in a single phrase structure rule as follows:
The constituents in parentheses are optional. This rule states that a noun phrase
consists of a noun, possibly preceded by a determiner and an adjective (in that
order). This rule does not cover all possible NPs.
The noun phrase may include post-modifiers and more than one adjective. For
example, it may include a prepositional phrase (PP). More than one adjective is
handled by allowing an adjective phrase (AP) for the adjective in the rule. After
incorporating PP and AP in the phrase structure rule, we get the following:
• They (1a)
• The foggy morning (1b)
• Chilled water (1c)
• A beautiful lake in Kashmir (1d)
• Cold banana shake (1e)
Let us see how the phrases (1a–e) can be generated using phrase structure rules.
The phrase (1a) consists only of a pronoun; (1b) consists of a determiner, an
adjective (foggy) that stands for an entire adjective phrase, and a noun; (1c)
comprises an adjective phrase and a noun; (1d) consists of a determiner (the), an
adjective phrase (beautiful), a noun (lake), and a prepositional phrase (in Kashmir);
30 | P a g e
MODULE 2 NLP [BAI601]
In (2a), the noun phrase acts as a subject. In (2b), it acts as an object, and in (2c),
it is a predicate.
Verb Phrase: Analogous to the noun phrase is the verb phrase, which is headed
by a verb. There is a wide range of phrases that can modify a verb. This makes
verb phrases a bit more complex. The verb phrase organizes various elements of
the sentence that depend syntactically on the verb.
As you can see from these examples a verb phrase can have a verb [VP → Verb in
(3a)]; a verb followed by an NP [VP → Verb NP in (3b)]; a verb followed by a PP
31 | P a g e
MODULE 2 NLP [BAI601]
[VP → Verb PP in (3c)]; a verb followed by two NPs [VP → Verb NP NP in (3d)];
or a verb followed by two NPs and a PP [VP → Verb NP NP PP in (3e)]. In general,
the number of NPs in a VP is limited to two, whereas it is possible to add more
than two PPs.
Things are further complicated by the fact that objects may also be entire clauses
as in the sentence, I know that Taj is one of the seven wonders.
Hence, we must also allow for an alternative phrase statement rule, in which NP is
replaced by S.
VP → Verb S
The phrase structure rule that captures the above eventualities is as follows:
PP → Prep (NP)
• Ashish is clever.
• The train is very late.
• My sister is fond of animals.
32 | P a g e
MODULE 2 NLP [BAI601]
Sentences with an imperative structure usually begin with a verb phrase and lack
subject. The subject of these types of sentences is implicit and is understood to be
‘you’. These types of sentences are used for commands and suggestions and hence
are called imperative. The grammar rule for this kind of sentence structure is:
S → VP
33 | P a g e
MODULE 2 NLP [BAI601]
Sentences with the yes-no question structure ask questions which can be answered
using yes or no. These sentences begin with an auxiliary verb, followed by a subject
NP, followed by a VP. Here are some examples:
We expand our grammar by adding another rule for the expansion of S, as follows:
S → Aux NP VP
Sentences with wh-question structure are more complex. These sentences begin
with a wh-word—who, which, where, what, why, and how. A wh-question may
have a wh-phrase as a subject or may include another subject. Consider the
following wh-question:
Another type of wh-question structure is one that involves more than one NP. In
this type of questions, the auxiliary verb comes before the subject NP, just as in
yes-no question structures.
34 | P a g e
MODULE 2 NLP [BAI601]
____________________LECTURE 14______________________
2.7 Parsing
A CFG defines the syntax of a language but does not specify how structures are
assigned. The task that uses the rewrite rules of grammar to either generate a
particular sequence of words or reconstruct its derivation (or phrase structure tree)
is termed parsing. A phrase structure tree constructed from a sentence is called a
parse. The syntactic parser is thus responsible for recognizing a sentence and
assigning a syntactic structure to it. It is possible for many different phrase
35 | P a g e
MODULE 2 NLP [BAI601]
structure trees to derive the same sequence of words. This means a sentence can
have multiple parses. This phenomenon is called syntactic ambiguity.
Example 1: Perform top-down parsing for the sentence “Paint the Door” using the
grammar given below:
S → NP VP
S → VP
NP → Det Nominal
NP → Noun
NP → Det Noun PP
Nominal → Noun
Nominal → Noun Nominal
VP → Verb NP
VP → Verb
PP → Preposition NP
Det → this | that | a | the
Verb → sleeps | sings | open | saw | paint
Preposition → from | with | on | to
Pronoun → she | he | I | they
A top-down approach begins with a start symbol of the grammar. The given
grammar has two rules with S. These rules are used to expand the tree, which gives
36 | P a g e
MODULE 2 NLP [BAI601]
us two partial trees at the second level search. Further expansion is generated based
on non-terminals given in grammar.
37 | P a g e
MODULE 2 NLP [BAI601]
38 | P a g e
MODULE 2 NLP [BAI601]
39 | P a g e
MODULE 2 NLP [BAI601]
40 | P a g e
MODULE 2 NLP [BAI601]
REVIEW QUESTIONS
41 | P a g e
MODULE 2 NLP [BAI601]
____________________LECTURE 15______________________
A → BC
A → w, where w is a word.
The algorithm first builds parse trees of length one by considering all rules which
could produce words in the sentence being parsed. Then, it constructs the most
probable parse for all the constituents of length two. The parse of shorter
constituents constructed in earlier iterations can be used in constructing the parse
of longer constituents.
The steps involved in algorithm are shown below:
_________________________________________________________________
for i := 1 to n do
for all rules A → wᵢ do
chart[i,1] = {A}
for j := 2 to n do
for i := 1 to n - j + 1 do
begin
chart[i,j] = ϕ
for k := 1 to j - 1 do
chart[i,j] := chart[i,j] ∪ {A | A → BC is a production and
B ∈ chart[i,k] and
C ∈ chart[i+k, j-k]}
End
42 | P a g e
MODULE 2 NLP [BAI601]
Example: Tabulate the sequence of states created by CYK algorithm while parsing
“the flight includes a meal”.
For filling the CYK table for the sentence: "the flight includes a meal", the
words - ["the", "flight", "includes", "a", "meal"]
are indexed from 1 to 5.
0 the 1 flight 2 includes 3 a 4 meal 5
43 | P a g e
MODULE 2 NLP [BAI601]
44 | P a g e
MODULE 2 NLP [BAI601]
Updated table:
45 | P a g e
MODULE 2 NLP [BAI601]
Final Table:
REVIEW QUESTIONS
1. What is the required form of grammar for applying the CYK algorithm?
2. Is CYK parsing a top-down or bottom-up approach?
3. What data structure is primarily used in CYK parsing?
4. What is the time complexity of the CYK algorithm?
46 | P a g e