Design Advice Needed For Synonyms Database

Posted by James J on Stack Overflow See other posts from Stack Overflow or by James J
Published on 2011-11-30T17:38:17Z Indexed on 2011/11/30 17:52 UTC
Read the original article Hit count: 137

Filed under:

I'm planning to put together a database that can be used to query synonyms of words. The database will end up huge, so the idea is to keep things running fast.

I've been thinking about how to do this, but my database design skills are not up to scratch these days.

My initial idea was to have each word stored in one table, and then another table with a 1 to many relationship where each word can be linked to another word and that table can be queried.

The application I'm developing allows users to highlight a word, and then type in, or select some synonyms from the database for that word. The application learns from the user input so if someone highlights "car" and types in "motor" the database would be updated to link the relationship if it don't exist already.

What I don't want to happen is for a user to type in the word "shop" and link it to the word car. So I'm thinking I will need to add some sort of weight to each relationship.

Eventually the synonyms the users enter will be used so they can auto select common synonyms used with a certain word. The lower weight words will not be displayed so shop could never be a synonym of car unless it had a very high weight, and chances are nobody is going to do that.

Does the above sound right? Can you offer any suggestions or improvements?

© Stack Overflow or respective owner

Related posts about database-design