creating dictionary in c++

Posted on 2005-03-18
Medium Priority
Last Modified: 2012-05-05
please,help me building a dictionary code in c++.where user can input data,and then search it .example user enter the word and gets its meaniing ,synonym,antonym
Question by:Fahdmurtaza
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

cybertopia earned 1000 total points
ID: 13577637
Maybe you can do this:
make a char multi-dimensional array or vector array with 2 columns
put each word in a row in the array (1st column)
then when the user wishes to search for the word, using strstr, if it finds a match, it will return that word.

in the 2nd column, it contains a pointer to any extra data you want it to contain.  this could be pointed to an array with synonyms, antonynms, etc.

ways to optimize:
sort the array after each insertion
use a divide and conquer strategy

LVL 25

Expert Comment

ID: 13578565
There's millions of words that they could search for... are you really going to type them all in?

I doubt it.

I had to do something slightly similar.. where the user typed in an IP address (I used Java for this btw), and then my program would return the location of that IP (the country, sometimes the town, and sometimes the actual house number [for registered IPs]).
This was quite difficult.. What I done (successfully), was develop a custom bot, to search the official WHOIS search websites, such as RIPE, etc (dependant on the range of the IP), then it would parse the returned data, to extract the address/location.. This was very very tedious.. But a simple dictionary search would be pretty damn easy (if you were to use a similar method).

Best of luck,
>> IM

Expert Comment

ID: 13579998
Sorry to intrude but InteractiveMind, is there any chance you can share the code that you used to extract the information off of the WHOIS websites?  I can post a seperate question if necessary.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 23

Expert Comment

ID: 13580739
Couldnt you create a database and have a c++ GUI with interface that querrys the database each time an addition is made to check to see if that addition exists or not, if it does then to deny the entry because there is no point in storying the same word along with its defintion , etc more then once.

This way you can make a searchable dictionary which you can add to, update and or delete words if necessary :)
LVL 25

Expert Comment

ID: 13581522
Hi Mortar,

I don't believe that I still have it, it was a project I done for someone quite a long time ago.. But I *might* have some of the API I created for it in my chunky, code library :)

>> IM

Expert Comment

ID: 13582326
Probably the simpliest would be to create a database.

Word Table
Col1: ID
Col2: Word

WordDefLink Table  (Each word could have multple definitions)

Defintion Table
Col3:Synonyms (delimited list of synonyms)
Col4:Antonyms (delimited list of antonyms)

WordSoundExLinkTable (each word could have multiple soundex keys)
Col1: WordID
Col2: SoundExID

SoundExKey Table  
Col1: SoundExID
Col2: SoundEx of Word

1) User enters a word, you look it up in word table.  Present all defintions related to word.  Include list of synonyms and antonyms.
2) If word is not found, do a soundex on the user's work, search the SoundExKey table for the values, link back to Word Table to list possible suggestions.  

Doesn't handle prefix and suffix (stemming) but it is a start.

You also may want to look a this link for some ideas.
LVL 23

Expert Comment

ID: 13582343
I am not really all that great when it comes to database's so I just wanted to say thank you to SCDMETA for ellaborting on my suggestion ! I hope this gives you a better idea with regards to the dictionary you are making or w/e.

Kind regards


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Six Sigma Control Plans
Introduction to Processes

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question