I am working on a content redirector, basically it will replace the words with its synonyms.
I have synonyms in mySQL database, the table contains 3 columns
id int(11)
keyword varchar(50)
synonyms varchar(255)
The entries are as follows:
50 slake abate,slack,decrease,lessen,minify
51 abate slake,slack,decrease,lessen,minify
52 slack slake,abate,decrease,lessen,minify
53 decrease slake,abate,slack,lessen,minify
54 lessen slake,abate,slack,decrease,minify
55 minify slake,abate,slack,decrease,lessen
So, my first idea was to first get each word in the text for rewriting (ignoring some keywords in the blacklist) and then make a sql query to see if there is a synonym for this word in the database. But if I have text with 1000 words, will there be too many 1000 sql queries? In addition, some synonyms have 2 words (for example, βthrow awayβ), so I may need to make a lot more queries than a word in the text.
Is there a better way to achieve this?