Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program in python that can count meaningful words in the book provided.

ID: 3820800 • Letter: W

Question

Write a program in python that can count meaningful words in the book provided. The word count is the number of words in a document or passage of text. Word counting may be needed when a text is required to stay within certain numbers of words. sample program written by Python. You can modify the program to get correct output.

% yarn jar hadoop-streaming.jar -input 44604.txt.utf-8 -mapper mapper.py -output myout10 -reducer reduce.py –file mapper.py -file reduce.py

% hadoop fs -cat output15e/part-00000

%%% You need to write or modify the programs to get the correct results.

Your results should be located in a directory output-xyz under your account directory on Hadoop File Systems. You can change the xyz to produce different names.

Explanation / Answer

example : wordstring = 'it was the best of times it was the worst of times ' wordstring += 'it was the age of wisdom it was the age of foolishness' wordlist = wordstring.split() wordfreq = [] for w in wordlist: wordfreq.append(wordlist.count(w)) print("String " + wordstring +" ") print("List " + str(wordlist) + " ") print("Frequencies " + str(wordfreq) + " ") print("Pairs " + str(zip(wordlist, wordfreq)))

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote