Good database and structure to store synonyms

2019-01-26 21:52发布

If you could choose the database you want and have to store (query and update) word synonyms then what database would you choose? And how would you store them? Let's assume that there will be a lot of synonyms (but I guess data size won't be a problem here).

2条回答
够拽才男人
2楼-- · 2019-01-26 21:55

a simple relational structure might be like this:

word
------
word_id
text

synonym
---------
word_1_id
word_2_id
查看更多
该账号已被封号
3楼-- · 2019-01-26 22:03

Keeping it very simple, you could create a table of words and a relationship table for synonyms. You could consider adding a restriction like WordID1 < WordID2 to prevent repeating pairs of words (e.g, (1,2) and (2,1)).

enter image description here

查看更多
登录 后发表回答