开发者

Good database and structure to store synonyms

开发者 https://www.devze.com 2023-02-22 20:19 出处:网络
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 th开发者_如何学Cat there w

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 th开发者_如何学Cat there will be a lot of synonyms (but I guess data size won't be a problem here).


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)).

Good database and structure to store synonyms


a simple relational structure might be like this:

word
------
word_id
text

synonym
---------
word_1_id
word_2_id
0

精彩评论

暂无评论...
验证码 换一张
取 消