By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,261 Members | 1,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,261 IT Pros & Developers. It's quick & easy.

thesaurus in c

P: 3
can u pls help me in my project.. considering that u have a textfile then you try to search a word from the file, which i was able to implement, how can i show its synonyms? i got a list of synonyms from project gutenberg but im having a hard time on how to use it well for the word search.
Mar 13 '07 #1
Share this Question
Share on Google+
4 Replies


Ganon11
Expert 2.5K+
P: 3,652
You could try using an array of linked lists. Each linked list will hold the original word (as the first element) and any synonyms (anything after the 1st element). The array, then, holds the address of each linked list. As you read your file, you can create a new word, add it to a linked list, then add the rest of the words to the list, and finally put the finished list in the first element of the array, then move on.
Mar 13 '07 #2

P: 39
The problem with link-lists would be that there would be an excessive amount of memory or storage used. Why, as previously stated:
Each linked list will hold the original word (as the first element) and any synonyms (anything after the 1st element).
which means not only would there be a potentially a significant amount of redundancy but new memory address for each of those words. Not to mention what that link-list would look like after a few hundred words. As always, there are lots of ways of doing things, I suggest researching associative arrays such as maps, coding-wise will be much easier to develop and maintain.
Mar 13 '07 #3

Ganon11
Expert 2.5K+
P: 3,652
Using a map, I'd assume you'd use the word as the key and an array/list/other container of words as the value, which would still result in some of the same problems as you listed above.
Mar 13 '07 #4

P: 39
yes but using maps for example, will result in less coding, easier implamentation through this massive container. it could even allow someone to be creative and only load certain ranges of words and leave the rest in a file. creating a link-list and iterating through memory addresses can be time consuming. that is all.
Mar 13 '07 #5

Post your reply

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