Connecting Tech Pros Worldwide Help | Site Map

Please, please help me urgent!!!

Newbie
 
Join Date: Sep 2006
Posts: 3
#1: Nov 26 '06
I need help guys, i have to many stuff to do, because i am in my last 2 weeks of the university, my last assignment is to do a spell checker in C++, i have an idea but nothing is coming out. I really need help, could someone do, anything to help me i don't have much time, here are the instructions:

Instructions:
In this project, you are asked to develop your own spell-checker utility. We make suggestions to help get you started. You should then consider adding more capabilities. You might find it helpful to use a computerized dictionary as a source of words.
Why do we type so many words with incorrect spellings? In some cases, it is because we simply do not know the correct spelling, so we make a "best guess." In some cases, it is because we transpose two letters (e.g., "defualt" instead of "default"). Sometimes we double-type a letter accidentally (e.g., "hanndy" instead of "handy"). Sometimes we type a nearby key instead of the one we intended (e.g., "biryhday" instead of "birthday"). And so on.
Design and implement a spell-checker program. Your program will access a file called Dictionary.txt which contains the available words.
Your program asks a user to enter a word. The program then looks up that word in the file. If the word is present in the file, your program should print "Word is spelled correctly".
If the word is not present in the file, your program should print "Word is not spelled correctly." Then your program should try to locate other words in the file that might be the word the user intended to type. For example, you can try all possible single transpositions of adjacent letters to discover that the word "default" is a direct match to a word in the file. Of course, this implies that your program will check all other single transpositions, such as "edfault," "dfeault," "deafult," "defalut" and "defautl." When you find a new word that matches one in the file, print that word in a message such as "Did you mean "default?"."
Implement other tests, such as the replacing of each double letter with a single letter and any other tests you can develop to improve the value of your spell checker.

For this assignment you don't need a complete dictionary, only a minimum of 1000 words...

Please help me out, i have to much things to do i don't have time to break my head doing this in such little time, thanks
luninspectra's Avatar
Newbie
 
Join Date: Nov 2006
Posts: 6
#2: Nov 27 '06

re: Please, please help me urgent!!!


I don't know the process for reading strings, but here are some ideas:

What to Check:
-If the user hit the wrong key but key is proximal to the letter: defaylt (default)
-If the user misspelled it due to typing out of order: defalut (default)
-If the user typed a word that wasn't on the list: defawlt (default) <--Hardest

================================================== ===
If the user hit a key thats proximal to the letter the user attempted to hit
================================================== ===

Declare an array of characters corresponding to your keyboard, each with up to 9 elements.

So char letter_a[9];

letter_a[0] = 'a';
letter_a[1] = 'q';
letter_a[2] = 'w';
letter_a[3] = 's';
letter_a[4] = 'x';
letter_a[5] = 'z';

Note that a, q, w, s, x, and z are all close to the letter A. (On a QWERTY keyboard). Do the same across the alphabet.

You will use the 27 arrays to check if the user accidentally hit the wrong key. i.e. defaylt (default).

=======================
If the user hit a key out of order
=======================

Declare an array of characters with 255 elements (255 characters long)
Check how long the string is (defualt (default) = 7 characters long)


Put the string into the character array:
character[0] = 'd';
character[1] = 'e';
character[2] = 'f';
character[3] = 'u';
character[4] = 'a';
character[5] = 'l';
character[6] = 't';

Rearrange the characters each by 1 place to hopefully compile a word in the dictionary:

defualt rearranges to:
-edfualt
-dfeualt
-deufalt
-default <---BINGO
-defalut
-defaltu
(7 different rearrangements, 7 characters)

This algorithm (not verified) checks all possible rearrangements (7):

for(int i = 0; i < number_of_characters; i++) {

char placeholder;

placeholder = character[i];
character[i] = character[i + 1];
character[i + 1] = placeholder;

for(int c = 0; c < number_of_characters; c++) {
//This for loop will merge the characters to make a string

string word = character[0]; //The start of the word

word = word + character[c + 1];
}

check_dictionary(word);
}

I'm a little blank to think of something for the last thing to check (if the word isn't even in the dictionary). I have some ideas but they are ehh...alright:

If the user typed a word, defaulo (...yet again, default)
check if defaulo is in the dictionary
check if defaul is in the dictionary
check if defau is in the dictionary

(Checking is an easy algorithm that doesn't need to be put up)

Yep, thats what I got.
Newbie
 
Join Date: Sep 2006
Posts: 3
#3: Nov 27 '06

re: Please, please help me urgent!!!


Thanks man good help, thanks for your time and effort, does anyone have more ideas o has anyone has done this problem?
Reply