Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Al Ain University (AAU)

College of Engineering (CoE)

Data Structures & Algorithms (0102270)

Project ( iSpell)

Fall Semester
Project Dec. 5, 2022
2022-23

Student ID
Student Name

Student ID
Student Name

Course Learning Total Student


Part #
Outcomes (CLO) Mark Mark
1 4 5
2 5 5

Total 10

Instructions:
1. Read these instructions and the questions carefully.
2. Do not forget to write your names and your student ids.
3. This is a group-based project; a maximum of two members per group is allowed.
4. Plagiarism is not tolerated. Students submitting cheated code will obtain zero grade in the
assignment.
5. Upload your code on Moodle. You need to upload all required files.

1 /3
In class, we looked at how to use Hash Tables to implement efficient search of given
keys. One natural use of a hash table is to hold the words in a spelling dictionary. This
makes looking up the words very efficient. In this assignment, you will implement and
use such a dictionary.

The assignment has two parts

Part No1:
For the first part of the assignment, you should write a class that implements a
Hashtable of words and class objects.  Word class objects have simply 2 attributes the
word and its definition (meaning).  Your word dictionary class should support the
following methods(functions)

A method add(s) that adds the string s to the table, if it is not already there.

A method remove(s) that removes the string s from the table, if it's there.

A method contains(s) that returns a Boolean value that checks whether the string s is in
the table.

A method size () that returns the number of strings in the table.

A hash method to compute the hash code of a string. This function can be private.

A constructor method that accepts the size of the table as a parameter.

Your dictionary should read the words from the attached .CSV file, which has 12K words.
Note that some words are repeated with a different meaning. Your dictionary must
handle this repetition (in any way you find efficient).

Part No2:
The second part of the assignment is to write a test class called Ispell that uses your
word dictionary class. The test program will behave interactively to check individual
words. You will be prompted to enter words. When you type a word, there are three
possible responses:

1. OK: An output of "ok" means that the word is in the dictionary. It will also display
the list of meanings it might have (A word might have more than one meaning).

2
2. Not found: An output of "not found" means that the word is not in the
dictionary and neither are any near misses.
3. List of similar words: Otherwise, the output is a list of near misses, that is, words
that are in the dictionary and are similar to what you typed, Optionally select
just two options from table no1.

The ispell program recognizes several types of near-misses: single-letter omissions,


single-letter additions, transpositions of two neighboring letters, substitution of one
letter for another, and two words run together.

Searching for near misses will require a significant amount of programming. You will
have to generate every possible near miss and look for it in the dictionary. Specifically as
below:

(a). Construct every string that can be made by deleting one letter from the word. (n
possibilities, where n is the length of the word)

(b). Construct every string that can be made by swapping two neighboring characters in
the string. (n-1 possibilities)

Ideally, you should list the near misses in alphabetical order (sort them).

One issue that you will have to settle is what to do with upper-case letters. Note that
both the words in the dictionary and the user's input can contain upper case letters. I
suggest that you simply convert all letters to lower case.

If you would like to do some extra credit work on this assignment, talk to be about
writing a program that can spellcheck files instead of individual words, or solve all near
misses options.

Your team must submit the following items:

1- All files in the Java program. (Exported as Netbean .ZIP file)


2- The input and output files used for testing the program.
3- A project report, 200 words or more, explaining how the program works and
describing the ADTs used. The report should also include a screenshot of
different test cases.

You might also like