473,659 Members | 2,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please, please help me urgent!!!

3 New Member
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 2129
luninspectra
6 New Member
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_chara cters; i++) {

char placeholder;

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

for(int c = 0; c < number_of_chara cters; 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_dictionar y(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 New Member
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
6704
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 pParam) for a thread The reason that I want it to belong to the class CCOMM1Dlg is that in this function I need to process some member variables of the class.
1
1515
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 a struct with entry, date, time, type. the problem is: if i use the change-function to add a (optional) time to an
2
1255
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 null. as it is now i get: "Compilation Error" "Compiler Error Message: BC30201: Expression expected"
5
2190
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 added a click event handler that resets the selected items based on whats in the collection it is data bound to... I'm baffled, pounding my head against the wall, it's not working... Please help... I tried posting the code but it was too long,...
7
1475
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 SET has_letter1 = ( SELECT i.letter1 FROM olddb.student i, student_db student s WHERE s.unique_key = i.unique_key )
2
1530
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 Settings\User\Desktop\help.db";Extended Properties=Paradox 5.x I receive as an answer the following: "Could not find installable ISAM"
0
984
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 with table3. Now i have to compare a data in table 3 for one of the rows in table1 where as For the same row in table1 there will 100 rows in table 2 and for each row in table2 there will be 100 rows in table 3. So I need to write a stored...
0
910
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 search through two list boxes at the same time and find matching entries and copy the matching entries into a third list box. Additionally, I need to know how to sort my lists alphabetically without using the sort property. My professor says I ...
3
2762
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 code for another scenario and it gives me compile error:method or data member not found. My scenario is i have a nested tab page.My main tabbed page has 4 tabs, About, SafetyLevel1,SafetyLevel2,SafetyLevel3. Inside this main, i created a...
4
3285
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 all machine. then I made .exe (VB) then it is working fine in two machine. In one machine, I got log file in the appliaction folder opening vb application
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8335
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8528
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.