Question
In the above question, while calculating the occurrences of the words, we also need a counter of the number of sentences said by DUNCAN and
In the above question, while calculating the occurrences of the words, we also need a counter of the number of sentences said by "DUNCAN" and number of sentences said by "MALCOLM" in the dataset (i.e. from the play Macbeth).
The excerpts from the play are as below :
DUNCAN. Dismay'd not this DUNCAN. So well thy words become thee as thy wounds; DUNCAN. Whence camest thou, worthy Thane? MALCOLM. What will you do? Let's not consort with them. MALCOLM. This murtherous shaft that's shot MALCOLM. Let us seek out some desolate shade and there DUNCAN. Great happiness!
Constraints:
- Assume that the first string/name in each sentence starts with the person who has spoken that line.
- Use Counters to solve this problem
Hint:
- Add counters to the solution of the above question to get count of the lines spoken by DUNCAN and MALCOLM.
- The value of the counter should be printed in MapReduce output console.
- Refer CountersLinks to an external site. API
Sample Output:
DUNCAN=5
MALCOLM=30
Expected Solution: You need to paste the MR code, Hadoop commands & path of the final jar that is used to achieve this output.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started