Write a program that reads in a file full of words, and builds a hash table of all of the words. Next, the program should read in a file containing text that should be compared against the provided dictionary.
For every string that is not a word in the file, your program should output a message saying that the string is not a word as follows: "Not a word: %s\n", where %s denotes the string, and the \n is a new line. For example:
lorelai:spellcheck chris$ cat wordfile chris hello orange lorelai:spellcheck chris$ cat dictionary chris lorelai:spellcheck chris$ ./spellcheck_debug dictionary wordfile Not a word: hello Not a word: orange
The program is to accept two command line arguments. The first command line argument is a file to be used as a dictionary. The second command line argument is a file to be searched for words/non-words. You should verify that the program has the correct number of command line arguments, and that the program's command line arguments are valid files.
The definition of a "word" is a sequence of non-space characters one after the other. A space character is defined by the isspace function. Valid input files will only have ONE space character separating words, which should help you parse the files.
You may assume a "word" will contain no more than 50 characters; any file with a "word" longer than 50 characters constitutes invalid input.
In order for me to test your program effectively, I will compile it using a variety of header files, which will control the number of threads used to do various tasks.
To assist you, I also provide two additional files. I make no guarantees about how correct or useful either file is.
Any student whose program is faster than my serial solution will receive 1 additional point. Any student whose program is faster than my parallel solution will receive 1 additional point.
These extra points will be applied independent of one another.
lorelai:cs520 chris$ time ls classes old_assts p2 p4 scripts midterm p1 p3 p5 website real 0m0.009s user 0m0.002s sys 0m0.003s
Your programs will be graded using agate.cs.unh.edu so be sure to test in that environment.
Remember: as always you are expected to do your own work on this assignment. Copying code from another student or from sites on the internet is explicitly forbidden!
% ~cs520/bin/DoSubmission.py prog5 file1 file2 file3 file4
This submission script is new. It passed what testing I have done on it, but it may still have issues. If there are any problems, please contact me via email and I will do my best to assist you. If I cannot be reached, please send me a copy of your assignment via email, and we will deal with the submission script later.