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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education