473,322 Members | 1,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Please, please help me urgent!!!

3
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
Nov 26 '06 #1
2 2103
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.
Nov 27 '06 #2
Bsnpr8
3
Thanks man good help, thanks for your time and effort, does anyone have more ideas o has anyone has done this problem?
Nov 27 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Liu Ju | last post by:
Dear members: I want to use the multithread in my program which is developed in Visual C++ platform (version 6). I created a controlling function: UINT CCOMM1Dlg::WritingThreadFunc(LPVOID...
1
by: progII | last post by:
Hello, i am struggling the whole night cos of my c++ homework. deadline is very soon. (april 4th) i have to implement a calender. i store every calender entry in a list. a calender entry is...
2
by: fredda054 | last post by:
I now get the following error with my repeater... short desc. of problem. I want to display hyperlinks with a repeater, but add "link not available" and disable the hyperlink if the field in DB is...
5
by: Alien2_51 | last post by:
I have a problem with a ListBox control that is on a TabControl, it seems to be forgetting which items are selected in the list when I tab off the current tab, here's my winform code... I even...
7
by: phillip.s.powell | last post by:
Now I have another SQL query for MySQL I can't figure out!! This is overwhelming me completely and I also must have this figured out today and I can't figure it out!! UPDATE student_db.student...
2
by: pamelafluente | last post by:
I am trying to connect to a PARADOX .db (vs2005). I am using an OLEDB connection. This is the connection string I am using: Provider=Microsoft.Jet.OLEDB.4.0; Data Source="C:\Documents and...
0
by: razaqtelecom | last post by:
Hi, I want to know how can i write a stored procedure for the following sceario. Take if there are three tables, table1, table2, table3 and table1 is linked with table2 and table 2 is linked...
0
by: kbloom503 | last post by:
Hi. I am required to take a VB .net 2005 programming course for my business major so have no clue what I am doing. I have a final homework assignment that needs to include a command control that will...
3
by: kev | last post by:
Hello, I posted a question a while ago on tabbed pages, how to set it to invisible when the text box is empty.It was answered by Rick and the code ran perfectly. However, i tried using the same...
4
by: musai | last post by:
I have created vb oracle application I installed oracle client in three machine. All machine was reconfigured after oracle installed I could see table and record set through sql plus sheet in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.