Alternative design for a synonyms table?

Posted by Majid on Stack Overflow See other posts from Stack Overflow or by Majid
Published on 2010-05-27T02:12:25Z Indexed on 2010/05/27 2:21 UTC
Read the original article Hit count: 286

Filed under:

I am working on an app which is to suggest alternative words/phrases for input text. I have doubts about what might be a good design for the synonyms table.

Design considerations:

  1. number of synonyms is variable, i.e. football has one synonym (soccer), but in particular has two (particularly, specifically)
  2. if football is a synonym to soccer, the relation exists in the opposite direction as well.
  3. our goal is to query a word and find its synonyms
  4. we want to keep the table small and make adding new words easy

What comes to my mind is a two column design with

  • col a = word and
  • col b = delimited list of synonyms

Is there any better alternative? What about using two tables, one for words and the other for relations?

© Stack Overflow or respective owner

Related posts about database-design