IT 279
Fall, 2022
Califf
Programming Assignment 2:
Working with Dictionaries
Due date for Part 1: Monday, September 26, 2022 at 11:55 pm
Due date for Part 2: Wednesday, October 5, 2022 at 11:55 pm
Remember that this is an individual assignment. Do not discuss with your classmates (or
others) and do not search for code on the web. You are encouraged to come to me for
help.
Description:
You are developing a C++ program that does spell checking on a text file. The program
will take 3 command line parameters which are names for:
1) a file with a list of correctly spelled words
2) a text file to check
3) an output file for the structure of the dictionary (not relevant to the task, but
important for grading your data structure accuracy).
The program will first build a dictionary from the word list. Then it will check the file,
printing information about each misspelled word and suggestions for possible corrections
to standard output. Finally, it will print the dictionary structure to the specified output
file.
Format of spelling output
For each misspelled word print the word and the line it was found on followed by
information about the suggestions found, followed by a blank line. Examples:
saed on line 5
Suggested corrections:
saved
sad
remirmand on line 6
No suggestions found
Note that the first line of the file is line 1, not line 0. We want this output to be human friendly, and most humans start counting at 1, rather than 0. Use tabs for the indentation
of the suggested words.
How to generate suggestions
As suggested corrections, list any words in the dictionary that are obtainable by applying
any of the following rules (one at a time):
1. Add one letter to the word (at any position)
2. Remove one letter from the word
3. Exchange adjacent characters
There is an opportunity to earn extra credit by thoughtfully expanding the suggestion list.
See below.
You will be starting with a partial program, which includes a dictionary, implemented as
a basic binary search tree and the framework of the actual program spell checking
program.
You will be filling in the part of the program that reads the word list and build the
dictionary as well as the part that does the actual spell checking.
Then you will also be modifying the dictionary to be an AVL tree implementation. Note
that your book does have some useful reference code to help you get started with the
AVL tree conversion.
For part 1, you will submit your program file and your AVL tree implementation, based
on the binary search tree implementation you were given. The program you submit must
work with either your Dictionary implementation or the provided Dictionary with NO
changes whatsoever. If the program does not compile with either Dictionary version, it
will be considered a compile-time error (automatic F).
For part 2, you will create a new Dictionary with the exact same interface (i.e. the same
public function signatures) but implemented as a hash table using double hashing to
handle collisions. You will submit your program with that Dictionary. The program must
still work with both the original Dictionary and your hash table with no modifications. If
your AVL tree had issues and you have fixed it for an improved grade, you may also
resubmit the AVL version of the Dictionary.
Simplifying Assumptions:
▪ We don’t care about case; convert everything to lower case when reading from all
files.
▪ Words are strings of letters (a-z). Treat everything that isn’t a letter as breaking
up words. Note that this means you may have multiple ”words” on a single line in
your word list – both should be entered in the dictionary. It also means that you
may have duplicates in your word list, which must be appropriately handled.
▪ Each line ends with a newline character.
▪ All files are in the same directory as the program.
Starting and sample files:
You will find Dictionary.h, Dictionary.cpp, and startingSpellChecker.cpp in
/home/ad.ilstu.edu/mecalif/it279/Program3. Make sure you read them carefully, including
all comments and understand how the code works. You will be adding code to all of these
files. You should not be removing anything from any files for part 1. For part2, you will
largely replace the contents of the Dictionary files, but make sure that you do not modify
the prototypes/headers of the public methods, and that you do not remove or add any
public methods.
You will also find a set of .txt files. I have provided dictionary files in multiple sizes
along with test1.txt, a file with several misspellings.
You have been given a simple test program (test_dictionary.cpp) along with correct
output for the BST you were given as well as the AVL and hash table versions you will
be creating.
I have also provided sample output from the spellchecker program. Note that the
dictionary structure output can be used to determine whether you are producing a correct
AVL tree. The hash table version of the dictionary structure output can be used to
examine your hash table. In addition to the standard output files, I have provided output
from printing the dictionary in order for each dictionary so that you can check those with
a separate little program. Note that the output from that will not vary from one
implementation to another.
Hash table details:
You will use double hashing. The prime numbers that you will use for your hash table
sizes are {101, 211, 431, 863, 1733, 3469, 6947, 13901, 27803, 55609, 111227, 222461,
444929, 889871}. The prime numbers for your double hashing will be {97, 199, 421,
859, 1723, 3467, 6917, 13883, 27799, 55603, 111217, 222437, 444901, 889829}.
Use the hash function from figure 5.4 in your textbook.
Rehash immediately before adding an entry that will push the table above 50% full.
Extra Credit Opportunity:
A and B programs may earn a small amount of extra credit for improving on the
algorithm to generate suggested corrections. Requirement for extra credit:
1) You must indicate in the textbox in your ReggieNet submission that you have
done the extra credit and you must explain how you are generating additional
suggested words and indicate which dictionary file to use for your sample
input/output demonstrating your work.
2) You must have an optional 4
th command line parameter. If the 4th parameter is
provided (whatever the contents of it), then your program will generate the
additional suggestions. If there is no 4th command line parameter, the program
must stick to the specified suggestions.
3) You must provide an input file and sample output that demonstrates your
additional suggestions. Please try to use sample input that doesn’t generate many
suggestions outside of your extra credit modifications. This will help in assessing
how effective your additions were.
4) The additions must be thoughtful. An “improvement” that simply generates a
huge number of suggestions without regard to whether they might make sense
will not gain additional credit.
Submission requirements:
When you use them, all versions of the dictionary must be in files named Dictionary.h
and Dictionary.cpp. However, we need to separate them out for submission. So your
AVL tree will be submitted as AVL_Dictionary.h and AVL_Dictionary.cpp. Your hash
table will be submitted as Hash_Dictionary.h and Hash_Dictionary.cpp. The grading
process will rename your files before compiling.
Remember that your program file must work with the original Dictionary files as
submitted. Submit a single zip containing only the source code files (no folders, no data
files, no executables, no test files, not even any makefiles for this) and your sample test
and output files if doing extra credit.
A validation script will be provided that will help you determine whether your
submission zip file is correct. It is your responsibility to make sure that your program
compiles successfully when you give the validation script your zip file. The validation
script will NOT test your code for you; it will only make sure your program compiles.
Failure to submit your program in accordance with instructions will result in a grade
reduction.
Grading Standards:
Programs will be graded in accordance with the provided Program Grading Criteria.
Part 1 will be 40% of the grade and Part 2 will be 60% of the grade. If you correct issues
with part 1 when submitting part 2, you will receive half of the difference between the
original grade for part 1 and the grade that part of program would earn with the
corrections.
Cultural Competence in Healthcare: Application of the Purnell Model Essay
Cultural Competence in Healthcare: A Case Study Analysis Using the Purnell Model Healthcare professionals increasingly encounter diverse patient populations, necessitating cultural competence for effective care delivery. This paper examines a significant cross-cultural healthcare interaction through the lens of the Purnell Model for Cultural Competence, emphasizing the critical role of communication in transcultural nursing care. Case […]