NPTEL NLP Assignment 5
NPTEL NLP Assignment 5
Assignment 5
Type of Question: MCQ
================================================================
Question 1.
Which of the following are true?
A) Given a CFG and its corresponding CNF, they produce different languages.
B) It requires ‘2n-1’ productions or steps in CNF to generate a string w of length
‘n’.
C) For a given grammar, there can be one CNF.
D) All of the above
Answer: B
Solution: Given a CFG and its corresponding CNF, they produce the same
language.
Let n be the length of a string. We start with the (non-terminal) symbol S which has
length n=1. Using (n−1) rules of form NT→NT NT (where NT represents a
non−terminal) we can construct a string containing ‘n’ non-terminal symbols. Then on
each NT symbol of said string of length ‘n’ we apply a rule of form NT→T. i.e. we
apply n rules. In total we will have applied
(n−1) + n = 2n−1 rules.
================================================================
Question 2.
Consider the CFG given below:
S → xSy|V
V → Vz|ϵ
How many non-terminals should be added to convert the CFG into CNF?
A) 2
B) 4
C) 5
D) 3
Answer: C
Solution: The final CNF is:
S′ → AE|AB|VC|z
S → AE|AB|VC|z
E → SB
V → VC|z
A→x
B→y
C→z
===============================================================
Question 3:
the CFG to CNF converted form?
In the above Q. 2) How many different numbers of Null productions in
A) 0
B) 1
C) 2
D) 3
A) 2
B) 4
C) 7
D) 10
Answer: C (7)
================================================================
For Question 5 to 7 consider the following PCFG fragment:
S → NN VP 0.50 S → VP NN 0.50
NP → NN PB 0.40 P B → PP NN 0.30
V P → VB NN 0.30 V P → VB NP 0.20
V P → NN VB 0.25 V P → NN PB 0.15
P P → with 0.10 P P → without 0.10
V B → play 0.30 V B → enjoy/like 0.20
V B → watch/enjoy 0.25 NN → children/students 0.15
NN → cricket/football 0.15 NN → friends 0.20
NN → football/cricket 0.10 NN → music/painting 0.12
For a sentence S = w1w2w3w4, assume that the cells in the table are indexed as
follows:
Question 5:
Using CKY algorithm, find the probability score for the most probable tree for the
sentence S1 = “students play football with friends”.
A) 6.06 × 10−4
B) 1.62 × 10−6
C) 2.73 × 10−3
D) 4.33 × 10−6
Answer: B
Solution: Calculate the probability using the Bottom-Up method as explained in the
lecture. 2
================================================================\
Question 6:
Using CKY algorithm, find the number of parse trees for the sentence S2 = students
like painting and the probability score for “at least one of the probable trees”.
A) 1, 4.95 × 10−3
B) 3, 0.36 × 10−3
C) 2, 0.99 × 10−3
D) 2, 0.54 × 10−3
Answer: C
Solution:
There are two parse trees.
S → NN11 VP23 = 0.5 × 0.15 × (0.3 × 0.2 × 0.12) = 0.54 × 10−3
S → VP12 NN33 = 0.5 × (0.25 × 0.15 × 0.2) × 0.12 = 0.45 × 10−3
Total is sum of both of the above = 0.54 × 10−3 + 0.45 × 10−3 = 0.99 × 10−3
Question 7:
Consider the expression below:
P(“students enjoy cricket like painting”, N34|G) = Pj P(“students enjoy cricket like
painting” |Nj34, G)
What does the L.H.S. represent?
Answer: B
Solution: Refer to Inside-Outside Probabilities.
================================================================
Question 8:
Which of the following grammars are valid CNF?
1. a) A → B 2. A → BCD 3. A → BC
b) B → CD B → b B → ϵ
c) C → c C → c C → c
d) A → BC A → a
2. a
3. b
4. c
5. D
6. None
Answer: d
Solution: Valid CNF form is as follows:
A → BC
A→a
================================================================