Problem description Frequency analysis of words is commonly used in several fields like cryptography. In this problem, you need to write a program to capture set of words from the user and calculate the frequency of the most occuring words in the english language https://en.wikipedia.org/wiki/Most common words in English 2. Based on the test phrases that you used to test the program, it would be interesting to see if you notice any deviations from the ranking. Your program must do the following:- 1) While the user does not enter the word "quit" (the case doesn't matter) • Prompt user to enter a sentence • Split the sentence into words based on space character ( ') separator. 2) Display the following information about the words present in the sentences/phrases entered by the user entered. 1) Total number of words 2) Frequency of top ten frequently used words, "the", "be", "to", "of", "and", "a","in","that","have""i" © Jinu Kabala

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter19: Probabilistic Dynamic Programming
Section19.4: Further Examples Of Probabilistic Dynamic Programming Formulations
Problem 7P
icon
Related questions
Question
Python
Problem description
Frequency analysis 2 of words is commonly used in several fields like cryptography. In this problem, you need to write a program to capture set of words from
the user and calculate the frequency of the most occuring words in the english language https://en.wikipedia.org/wiki/Most_common words in English .
Based on the test phrases that you used to test the program, it would be interesting to see if you notice any deviations from the ranking.
Your program must do the following:-
1) While the user does not enter the word "quit" (the case doesn't matter)
• Prompt user to enter a sentence
• Split the sentence into words based on space character (' ') separator.
2) Display the following information about the words present in the sentences/phrases entered by the user entered.
1) Total number of words
2) Frequency of top ten frequently used words, "the", "be", "to", "of", "and", "a","in","that","have","i"
© Jinu Kabala
Sample test cases
You have to come up with your own test-cases, do not use the ones below. Also, your test cases must not overlap (they must test different aspects of your
program or requirement). These are meant to be sample test cases only.
Example 1:
The player is sompted to enter some text until the user enter "quit" (case-insensitive)
Player is prompted to enter a phrase/sentence
Enter some text:The Python interpreter is a computer program
Player did not enter quit, so player is prompted to enter a phrase/sentence
Enter some text:Code is a common word for the textual representation of a program
Player did not enter quit, so player is prompted to enter a phrase/sentence
Enter some text:Initially you may think of the interactive interpreter as a powerful calculator.
Player did not enter quit, so player is prompted to enter a phrase/sentence
Enter some text:A statement is a program instruction. A program mostly consists of a series of statements, and each statement usually app
ears on its own line.
Transcribed Image Text:Problem description Frequency analysis 2 of words is commonly used in several fields like cryptography. In this problem, you need to write a program to capture set of words from the user and calculate the frequency of the most occuring words in the english language https://en.wikipedia.org/wiki/Most_common words in English . Based on the test phrases that you used to test the program, it would be interesting to see if you notice any deviations from the ranking. Your program must do the following:- 1) While the user does not enter the word "quit" (the case doesn't matter) • Prompt user to enter a sentence • Split the sentence into words based on space character (' ') separator. 2) Display the following information about the words present in the sentences/phrases entered by the user entered. 1) Total number of words 2) Frequency of top ten frequently used words, "the", "be", "to", "of", "and", "a","in","that","have","i" © Jinu Kabala Sample test cases You have to come up with your own test-cases, do not use the ones below. Also, your test cases must not overlap (they must test different aspects of your program or requirement). These are meant to be sample test cases only. Example 1: The player is sompted to enter some text until the user enter "quit" (case-insensitive) Player is prompted to enter a phrase/sentence Enter some text:The Python interpreter is a computer program Player did not enter quit, so player is prompted to enter a phrase/sentence Enter some text:Code is a common word for the textual representation of a program Player did not enter quit, so player is prompted to enter a phrase/sentence Enter some text:Initially you may think of the interactive interpreter as a powerful calculator. Player did not enter quit, so player is prompted to enter a phrase/sentence Enter some text:A statement is a program instruction. A program mostly consists of a series of statements, and each statement usually app ears on its own line.
Player did not enter quit, so player is prompted to enter a phrase/sentence
Enter some text:qUiT
Player enters quit which signals the end of user text entry to the program.
The program displays the number of words and the frequency of top-10 most occurring words based on the texts you entered.
Your output should look like
Total number of words: 55
Word frequency of top ten words
the
3
be
of
4.
to.
and
1
a
in
that
have
8
O Constraints & Assumptions
• A word is only considered to be separated by white-spaces, don't worry about punctuation or any other delimiters. So there are two words "the," and
"people" in the sentence the, people
• The words are case insensitive. So 'The' is same as 'the'. And 'quit' is same as 'QulT'.
• We consider the top-10 words as the be to of and a in that have i
Transcribed Image Text:Player did not enter quit, so player is prompted to enter a phrase/sentence Enter some text:qUiT Player enters quit which signals the end of user text entry to the program. The program displays the number of words and the frequency of top-10 most occurring words based on the texts you entered. Your output should look like Total number of words: 55 Word frequency of top ten words the 3 be of 4. to. and 1 a in that have 8 O Constraints & Assumptions • A word is only considered to be separated by white-spaces, don't worry about punctuation or any other delimiters. So there are two words "the," and "people" in the sentence the, people • The words are case insensitive. So 'The' is same as 'the'. And 'quit' is same as 'QulT'. • We consider the top-10 words as the be to of and a in that have i
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Program on Numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr