Natural Language Processing
Assignment- 3
TYPE OF QUESTION: MCQ
Number of questions: 10 Total mark: 10 X 1 = 10
Question 1: Consider the following Wikipedia text on Extractive Summarization:
Here, content is extracted from the original data, but the extracted content is not modified in any
way. Examples of extracted content include key-phrases that can be used to tag or index a text
document, or key sentences including headings that collectively comprise an abstract, and
representative images or video segments, as stated above. For text, extraction is analogous to
the process of skimming, where the summary (if available), headings and subheadings, figures,
the first and last paragraphs of a section, and optionally the first and last sentences in a
paragraph are read before one chooses to read the entire document in detail. Other examples
of extraction that include key sequences of text in terms of clinical relevance…
Which of the following is correct? (Consider lowercase characters; ignore punctuations)
a. Pcontinuation(and) > Pcontinuation(in)
b. Pcontinuation(and) < Pcontinuation(in)
c. Pcontinuation(and) = Pcontinuation(in)
d. Data insufficient
Answer: c
Solution: “first and” appears twice, however will be counted once, since we only count the no.
of unique bigrams that end with “and”.
Question 2: Suppose you are reading an article on Sentiment Analysis. Till now, you have
read the words “sentiment”, “aspect”, and “opinion” - 5 times each, “triplet”, and
“extraction” - thrice each, “pointers”, “encoder”, “decoder”, and “network” - once each.
What are the Maximum Likelihood Estimate (MLE) and Good Turing Estimate
probabilities of reading “architecture” as the next word?
a. 4/25, 4/25
b. 0/25, 4/25
c. 4/25, 4/26
d. 0/25, 4/26
Answer: b
Solution: P*GT(architecture) = N1 / N, where N = Total occurrences of words already read.
Question 3. In a corpus, suppose there are 5 words, a, b, c, d and e. You are provided
with the following counts:
n-gram count n-gram count n-gram count
caa 0 aa 0 a 10
cab 3 ab 4 b 12
cac 2 ac 3 c 8
cad 0 ad 0 d 4
cae 3 ae 3 e 16
Use a Linear Interpolation based language model to estimate the trigram probabilities
Pinterpolation(wn|wn-1wn-2), where wn = {a,b,c,d,e}, wn-1 = a, and wn-2 = c. Consider the weights
corresponding to the bi-gram and unigram language models as 0.2 and 0.1 respectively.
a. 0.002, 0.3665, 0.251, 0.008, 0.3545
b. 0.02, 0.3665, 0.251, 0.008, 0.3545
c. 0.02, 0.3665, 0.251, 0.08, 0.3545
d. 0.02, 0.3545, 0.251, 0.008, 0.3665
Answer: b
Solution: Use the Linear Interpolation formula as explained in Lecture 12. The weights for the
tri-gram, bi-gram and unigram language models will be 0.7, 0.2 and 0.1.
Question 4. Consider the same corpus as given in Question 3. Use the recursive
definition of backoff smoothing to obtain the probability distribution Pbackoff(wn|wn-1wn-2),
where wn = {a,b,c,d,e}, wn-1 = a, and wn-2 = c. Assume that .
a. 0.1663, 0.3125, 0.1875, 0.0212, 0.3125
b. 0.1663, 0.3125, 0.3125, 0.0212, 0.1875
c. 0.1875, 0.3125, 0.1663, 0.0212, 0.3125
d. 0.0212, 0.3125, 0.1875, 0.1663, 0.3125
Answer: a
Solution: Follow the explanation given in Lecture 12. ƛa = 75/62.
Question 5. Consider the same corpus as given in Question 3. Calculate the Kneser-Ney
smoothed probability PKN(b|a), correct to two decimal places. Consider d = 0.75
a. 0.55
b. 0.37
c. 0.36
d. 0.38
Answer: d
Solution: Follow the explanation given in Lecture 12. Pcontinuation(b) = ¼, since there are a total of
4 bi-grams {ca, ab, ac, ae} with counts > 0.For calculating ƛa, |{w : c(a,w) > 0}| = 3 ({ab, ac, ae}).
Question 6: Match the following words with the type of morphemes they contain:
● w1: upbringing, w2: regularity, w3: readers, w4: walked
● (i) Only derivational, (ii) Only inflectional, (iii) Both derivational and inflectional
a. w1-(ii), w2-(i), w3-(iii), w4-(ii)
b. w1-(ii), w2-(i), w3-(ii), w4-(ii)
c. w1-(iii), w2-(i), w3-(iii), w4-(ii)
d. w1-(iii), w2-(i), w3-(ii), w4-(ii)
Answer: c
Solution: upbringing = up (derivational suffix) + bring (Root word) + ing (inflectional suffix).
regularity = regular (Root word) + ity (derivational suffix)
readers = read (Root word) + er (derivational suffix) + s (inflectional suffix).
walked = walk (Root word) + ed (inflectional suffix).
Question 7: identify the UPenn Treebank part of speech tag for the word “fast” in each of
the following sentences:
● Muslims fast during Ramadan.
● She spoke so fast that I could not follow her.
● There are several fast food centres around the city.
● He was fast asleep when I reached home.
a. VERB-VBP, ADJ-JJ, NOUN-NN, ADJ-JJ
b. VERB-VBP, ADJ-JJ, ADJ-JJ, ADV-RB
c. VERB-VBP, ADV-RB, ADJ-JJ, ADV-RB
d. VERB-VBP, ADJ-JJ, NOUN-NN, ADV-RB
Answer: c
Solution: Check at https://spacy.io/usage/linguistic-features
Question 8: Consider the following State Transition diagram with three states: Sunny,
Foggy and Rainy. The state-transition probabilities are mentioned.
Assume that the weather yesterday was “Foggy”, and today it is “Foggy” again. What is
the probability that it will be “Sunny” the day after tomorrow?
NOTE: Consider a First-Order Markov model.
a. 0.08
b. 0.16
c. 0.32
d. 0.64
Answer: c
Solution: According to Markov Chain assumption, tomorrow’s weather is only dependent on
today’s weather. Yesterday’s weather has no relevance.
P(d3=”Sunny”) = P(d2=”Foggy”|d1=”Foggy”) * P(d3=”Sunny”|d2=”Foggy”) +
P(d2=”Sunny”|d1=”Foggy”) * P(d3=”Sunny”|d2=”Sunny”) +
P(d2=”Rainy”|d1=”Foggy”) * P(d3=”Sunny”|d2=”Rainy”)
Question 9: Suppose you are locked in a room and you want to find out how the weather
is outside, ONLY based on how you feel. Assume a First-Order Hidden Markov Model
with three states {Sunny, Foggy, Rainy} with their transition probabilities as shown in
Question 8. You either feel Happy or Grumpy, thereby defining your set of observables.
The (emission) probabilities of how you feel given the weather outside are shown below.
Happy (H) Grumpy (G)
Sunny (S) 0.7 0.3
Foggy (F) 0.5 0.5
Rainy (R) 0.4 0.6
Suppose you feel Happy on Day 1, and Grumpy on Day 2. Let the initial probabilities (or
likelihood) of the weather being Sunny, Foggy, and Rainy on Day 1 be 0.5, 0.3, and 0.2
respectively. What is the probability of deriving the observed sequence of feelings, i.e.
{Happy, Grumpy}, given the model.
a. 0.23565
b. 0.23585
c. 0.33565
d. 0.33585
Answer: b
Solution:
Day 1 (d1):
P(e1 = H | d1 = S) = P(d1 = S) * P(H|S) = 0.5 * 0.7 = 0.35
P(e1 = H | d1 = F) = P(d1 = F) * P(H|F) = 0.3 * 0.5 = 0.15
P(e1 = H | d1 = R) = P(d1 = R) * P(H|R) = 0.2 * 0.4 = 0.08
Day 2 (d2):
P(e2 = G | d2 = S;e1,d1) =
P(e1 = H | d1 = S) * P(d2 = S | d1 = S) * P(G|S) +
P(e1 = H | d1 = F) * P(d2 = S | d1 = F) * P(G|S) +
P(e1 = H | d1 = R) * P(d2 = S | d1 = R) * P(G|S)
= 0.35 * 0.8 * 0.3 + 0.15 * 0.2 * 0.3 + 0.08 * 0.2 * 0.3 = 0.0978
P(e2 = G | d2 = F;e1,d1) =
P(e1 = H | d1 = S) * P(d2 = F | d1 = S) * P(G|F) +
P(e1 = H | d1 = F) * P(d2 = F | d1 = F) * P(G|F) +
P(e1 = H | d1 = R) * P(d2 = F | d1 = R) * P(G|F)
= 0.35 * 0.15 * 0.5 + 0.15 * 0.5 * 0.5 + 0.08 * 0.2 * 0.5 = 0.07175
P(e2 = G | d2 = R;e1,d1) =
P(e1 = H | d1 = S) * P(d2 = R | d1 = S) * P(G|R) +
P(e1 = H | d1 = F) * P(d2 = R | d1 = F) * P(G|R) +
P(e1 = H | d1 = R) * P(d2 = R | d1 = R) * P(G|R)
= 0.35 * 0.05 * 0.6 + 0.15 * 0.3 * 0.6 + 0.08 * 0.6 * 0.6 = 0.0663
Therefore, P (Happy, Grumpy) = 0.0978 + 0.07175 + 0.0663 = 0.23585
Question 10. Suppose you feel Grumpy on Day 1, Happy on Day 2, and Happy again on
Day 3. Considering the same model as defined in Question 9, what is the probability of all
three days being Sunny?
a. 0.04704
b. 0.10976
c. 0.02016
d. 0.07526
Answer: a
Solution:
P(d1 = S, d2 = S, d3 = S | e1 = G, e2 = H, e3 = H) =
P(d1 = S) * P(G | S) * P(d2 = S | d1 = S) * P(H | S) * P(d3 = S | d2 = S) * P(H | S)
= 0.5 * 0.3 * 0.8 * 0.7 * 0.8 * 0.7 = 0.04704
************END*******