Question: Problem 2 : ( 5 points ) You are asked to process pairs of words that appear together ( one after the other ) in

Problem 2: (5 points) You are asked to process pairs of words that appear together (one after the other) in
the document: how often this given pair occurs, compared to any other pairs starting with word: word1?
Write pseudo-code, showing Map and Reduce functions to address the above problem. If a second Map Reduce
iteration is required, then write again the new Map and Reduce functions. Please answer Question 1 and Question
2 below:
Co-occurrence of word1 and word 2, as you will read next, means that in a document we must find the
frequency/probability that word2 comes right after word 1 in a document and/or vice-versa.
Input: text documents
key: document id
value: text document
Output: key/value pairs where
key: pair(word1, word2)
value: #co-occurrences(word1, word2)/#co-occurrences(word1, any word)
Solve the problem when for the co-occurrence of word1-word2 we impose that word 1 must come first and word 2
must come second in the document.
Solution:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!