Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 603
  • Last Modified:

creating dictionary in c++

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
         thanks
0
Fahdmurtaza
Asked:
Fahdmurtaza
1 Solution
 
cybertopiaCommented:
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




0
 
InteractiveMindCommented:
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
0
 
mortarCommented:
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.
0
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.

 
gecko_au2003Commented:
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 :)
0
 
InteractiveMindCommented:
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
0
 
SCDMETACommented:
Probably the simpliest would be to create a database.

Word Table
Col1: ID
Col2: Word

WordDefLink Table  (Each word could have multple definitions)
Col1:ID
Col2:DefID

Defintion Table
Col1:DefID
Col2:Definition
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.
http://wordweb.info/developer/
http://wordweb.info/developer/SQL.html
0
 
gecko_au2003Commented:
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

Gecko
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now