Question: Following the instructions, write a script that counts duplicate words. Techniques like word frequency counting are often used to analyze published work. Other document analysis
Following the instructions, write a script that counts duplicate words.
Techniques like word frequency counting are often used to analyze published work. Other document analysis techniques are in natural language processing. Write a script that uses a dictionary to determine and print the number of duplicate words in a sentence. Treat uppercase and lowercase letters the same and assume there is no punctuation in the sentence. Words with counts larger than one have duplicates.
Input Text is a tongue twister from "John Harris's Peter Piper's Practical Principles of Plain and Perfect Pronunciation" (1813):
Peter Piper picked a peck of pickled peppers A peck of pickled peppers Peter Piper picked if Peter Piper picked a peck of pickled peppers Where is the peck of pickled peppers Peter Piper picked
Output Console:
WORD COUNT a 3 of 4 peck 4 peppers 4 peter 4 picked 4 pickled 4 piper 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
