thesaurus in c

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kachokaratz
    New Member
    • Mar 2007
    • 3

    thesaurus in c

    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.
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    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.

    Comment

    • lqdeffx
      New Member
      • Mar 2007
      • 39

      #3
      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.

      Comment

      • Ganon11
        Recognized Expert Specialist
        • Oct 2006
        • 3651

        #4
        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.

        Comment

        • lqdeffx
          New Member
          • Mar 2007
          • 39

          #5
          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.

          Comment

          Working...