I am trying to re-write a dictionary program in python(3.X). I have been using JSON but thought it could be fun to try my hand at SQLlite. My question is:
I have:
- a word
- a list of sentences using the word
- a list of synonyms
- a list of antonyms
what is the the cleanest way to organise the data using SQLite3?
what I thought was to one table with unique id’s for the ‘val and example’ and then create new entries for synonyms and antonyms if they do not yet exist.
ValId Val Eaxmples
1 'hot' 'the water is hot\n she's hot\n'
2 'warm' '...'
3 'cold' '...'
4 'freezing' '...'
but then how would I create a table that could point back to multiple id’s?
for example 'hot' points to 2 as a synonym and 3 , 4 as antonyms. How would I create multiple ponters, do I have to put them in a sting and then parse them, as I do not know how may synonyms or antonyms might be created.
LinksID ValID SynIDs AntsIds
1 1 2 3,4
I would create two separate tables, one for synonyms and one for antonyms where you have
FOREIGN KEYSto reference your words:Then you don’t have to worry about having an unknown number of synonyms and antonyms for each word. You would then get the following structure:
Your word table:
Your synonym table:
And your antonym table: