I. Plan
First of all, since I have only learned the syntax of C and Java programs, I have no idea about C ++/C #. I learned the syntax for about five hours.
Although I wrote a similar Java program last semester, I still feel that there are some differences in functions, and there are many different Java and C ++ methods, so I cannot directly modify it based on it. Write the functions of each small function for three hours, and write the recursive function to scan the folder for three hours.
After completion, the program needs to be optimized, which is expected to take about three hours.
Ii. Actual use
The actual time is worse than your own preferences. It takes about three hours to learn the C ++ syntax than the preferences, I think it is similar to the previous C and Java, although I still need to check books or Baidu usage in practice.
The compilation of these small functions takes about 6 hours. Each written small function requires a test, and various problems are constantly encountered. It takes a long time to modify these bugs.
The main recursive function really does not know how to access the directory, or determine whether a file is a file or a directory, so we have to go to Baidu. Finally, we found a similar one, made changes on the basis of it, and finally succeeded. However, it takes a lot of time to query various materials before Baidu, And the debugging process is not short. This process takes about 6 hours.
After a single word program is completed, the program is modified to support double and three word statistics. The idea of an algorithm takes 2 hours, and the Implementation takes 3 hours (this process takes a detour and begins to understand the incorrect requirements. It is designed to count a single word, double word, and three words at the same time, the subsequent changes took about half an hour ).
Because deadline is approaching and the time is not long enough, the optimization is not enough. It takes about three hours.
Iii. Performance Analysis
1. During optimization, the output functions of a single word, double word, and three words are combined into one function.
2. Modify the location of the final output file so that it is not placed in the searched folder, but in the initial folder.
3. The three-word statistics do not need to be connected to the three words, but the intermediate results of the two words are called.
4. because the standard output does not have any output Content During the output, you may not know how much the program performs. Therefore, you can print the complete path of the scanned file, although there may be some performance loss.
5. the sorting of the linked list is somewhat difficult, so the Bubble Sorting is used at first. During optimization, the sorting method is replaced by the insert sorting method.
PS: the performance analysis before optimization is not done, so it is only the final performance analysis.
Iv. Test
PS: The empty folder has been tested. It is not used as a test point.
1. Test Two word loops, but the case is different (only three words ). Enter "C: \ Users \ CSJ \ Desktop \ test", source file
Output result
2. Test the recognition capability of other symbols on words (for example, the start of a number is not a word), input "C: \ Users \ CSJ \ Desktop \ test", source file
Output
3. Test the word separation function of other symbols. Enter "C: \ Users \ CSJ \ Desktop \ test", source file
Output (PS: excessive output, partial truncation)
4. The test word contains numbers. Enter "C: \ Users \ CSJ \ Desktop \ test ",
Source File
Output
5. Test multiple files and enter "C: \ Users \ CSJ \ Desktop \ test ",
Source File
Output
6. Test the recognition capability of files in multiple formats. Enter "C: \ Users \ CSJ \ Desktop \ test ",
Source File
Output
PS: each word appears once in each file, so it appears four times, proving that all four files have been scanned.
7. Test the separator identification capability between two words. Enter "-E2 c: \ Users \ CSJ \ Desktop \ test ",
Source File
Output
8. Test the three-word recognition capability. Enter "-E2 c: \ Users \ CSJ \ Desktop \ test"
Source File
Output
9. Test the file search capability of multi-level directories (put the same file into five files in different depths), and enter "C: \ Users \ CSJ \ Desktop \ test"
Source File
Output
PS: each word appears once or 6 times in each file, so it appears 5 or 30 times, proving that 5 files have been scanned.
10. Test the recognition capability for repeated occurrence of synonymous words in two consecutive word statistics,
Enter "-E2 c: \ Users \ CSJ \ Desktop \ test"
Source File
Output
PS: The 16 different case formats of file appear, which are considered to be the same word. Therefore, any two adjacent files can be considered to be the same, so the count is 15 times.
5. Feelings
This programming job is one of the most demanding and meticulous programs I have done, and it takes a lot of time to modify the output format. This gives me a warning, you need to write code later. Otherwise, there will be a lot of trouble in the future. The program encountered various problems during the debugging process. For example, after sorting by inserting algorithms one by one, there is always a problem with the order of the final output results. After looking for a long time, I finally found that when I checked whether a node was inserted to the head node of the linked list, the node selection for comparison was incorrect. It should have been t, the result is T-> nextword. This makes me understand that if I want to be a programmer, I need to be aware of the function algorithms. A small bug may cause a complete error in the results. Of course, the biggest achievement of this time should be that I have learned the C ++ syntax, and I have an additional skill.
After reading Zhang Yi's blog, his mind suddenly resonated. If it wasn't for programming under the strong pressure of teacher Wu last semester, suddenly such a program could not be started, so I would like to say thank you to this once-Disgusted teacher!
Document Term Frequency Statistics