We are trying to build a website for our school project. The site will be about a user entering a word and getting the sentences the word is used in and their translations. How can an effective database be designed to map a word to sentences the word is used in? We can simply create a word-to-sentence ID’s table, but it is not better than writing everything into a file.
Any ideas?
Using relational database for this is going into “when all you have is a hammer” territory. Searching for strings in text is a special case that many database engines have special tools for.
Nevertheless, if you want to use RDBMS then your idea of keeping a table full of sentences and a table full of words with an intersection table linking the two makes sense from a couple of perspectives. Since you’re also looking at translations you want a word table to link words in different languages. Also, if your word-to-sentence table contains a sequence number you can use that to find sentences where two words are used near (within a given distance of) each other.