NPTEL Natural Language Processing Week 5 Assignment Answers 2024
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 more than one CNF.
- D) None of the above
Answer: B, C
Explanation:
- CNF preserves the language of the original CFG, so A is false.
- In CNF, deriving a string of length
n
requires2n−1
steps because of the binary tree structure of CNF productions — B is correct. - Multiple equivalent CNF representations can exist for the same grammar — C is correct.
2. Consider the CFG given below:
S → xSylV
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
Explanation:
To convert this grammar into CNF, we need to replace mixed terminals and non-terminals, break down RHS with more than 2 symbols, and handle nullable productions. This usually introduces around 5 additional non-terminals.
3. In the above Q. 2, how many different null productions are there in the CFG to CNF converted form?
- A) 0
- B) 1
- C) 2
- D) 3
Answer: A
Explanation:
In CNF, all null (ε) productions are removed except possibly for the start symbol. So, after converting, null productions are typically eliminated — answer is 0.
4. In the above Q. 2, how many different production rules/steps are there in the CFG to CNF converted form?
- A) 2
- B) 4
- C) 7
- D) 10
Answer: C
Explanation:
The original grammar is broken down into binary rules and terminals are separated, which increases the number of rules. This results in approximately 7 rules.
5. Using CKY algorithm, find the probability score for the most probable tree for the sentence S₁ = “students play football with friends”.
- A) 6.06 × 10⁻⁴
- B) 1.62 × 10⁻⁶
- C) 2.73 × 10⁻³
- D) 4.33 × 10⁻⁶
Answer: B
Explanation:
The CKY algorithm uses dynamic programming to compute the highest scoring parse tree. From the precomputed probabilities, option B is the correct value.
6. Using CKY algorithm, find the number of parse trees for the sentence S₂ = “students like painting” and the probability score for at least one of the probable trees.
- A) 1, 4.95 × 10⁻³
- B) 3, 0.36 × 10⁻³
- C) 2, 0.99 × 10⁻³
- D) 2, 0.54 × 10⁻³
Answer: C
Explanation:
The sentence “students like painting” has 2 valid parse trees, and one of them has a score of 0.99 × 10⁻³ based on the CKY table.
7.
Answer: B
8. Which of the following grammars are valid CNF?
- a) A → B; A → BCD; A → BC
- b) B → CD; B → b; B → ε
- c) C → c; C → c; C → c
- d) A → BC; A → a
Answer: D
Explanation:
CNF rules must be of the form: A → BC or A → a (where B and C are non-terminals and a is a terminal).
- a) has invalid rules (BCD — too many non-terminals).
- b) includes ε which is not allowed unless it’s the start symbol.
- c) is repetitive and doesn’t follow CNF strictly.
- d) follows CNF perfectly.