Demand:
1. Design a procedure for Word frequency statistics.
2. English-language punctuation marks are not counted.
3. Sort the statistical results by the frequency of the occurrences of the word from large to small.
Design:
1. Basic functions and usage will be prompted in the program.
2. The principle is to use the delimiter Word to deposit the list, and then read from the list into the dictionary, the key is the word, the value of the number of words stored.
Code:
1. The module required to import the program.
2. Define the ReadFile class and implement the ability to remove punctuation in the article.
3. Define a GETSTR class to define the resulting output format.
4. Construct the program main function.
Test Case:
Test case I chose Martin Luther King's speech.
Some test results:
I also read the requirements of teacher Yang to other students, such as trying to run a run of "war and Peace" This English book, probably because the loadline number is too large, there is no operating results.
The above is the display of my program, the shortcomings of the teacher to give comments, thank you for your teacher.
Word frequency statistics for Python speech