Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Making thesaurus list out of syntax


I Will Make It

11:01 pm on Nov 1, 2010 (gmt 0)

5+ Year Member

Hi there!

I would like to create a database over synonyms, by splitting up a special article-syntax I have.

Example of how my article syntax is:

{main word|synonym1|synonym2|synonym3} {main word2|synonym1|synomym2|synonym3|synonym4}
... and so on.

I want to put "main words" in to the DB as the main words, and then attach the related synonyms to that word,

Can anyone give me a direction on how to accomplish this?


4:11 pm on Nov 2, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

I would expect many to many relationships among the various words, so a synonym of one word maybe a synonym of another word and then the words themselves can be synonyms to other words.

So I would build 2 db tables one to hold each word/synonym along with an identifier and another to assign relationships.

id word(varchar)
id with an autoincrement attribute

id1(int) id2(int)
where id1 and id2 are identifiers in table-1

Then setup a couple of rules when setting up table-2 so there id1 != id2 and combinations of id1/id2 are unique.

Then retrieve the rows for the synonym for a given word by getting the id from table 1 for a given word and then picking up the ids from table-2. You could perhaps apply a limit to the query to bring up just a number of synonyms.

You could also add an order field to the second table if you know the priority of combinations.

Featured Threads

Hot Threads This Week

Hot Threads This Month