Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3951696
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:45:41+00:00 2026-05-20T01:45:41+00:00

I am working on a content rewriter, basically it will replace words with their

  • 0

I am working on a content rewriter, basically it will replace words with their synonyms.

I have the synonms in a mySQL database, the table contains 3 columns

id        int(11)
keyword      varchar(50)
synonyms    varchar(255)

Entries looks like this:

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 every word in the text to rewrite (ignoring some keywords in a blacklist), and then making a sql query to see if a synonym for that word exists in the database. But if I have a text with 1000 words, would 1000 sql queries be too much? Also some of the synonyms have 2 words (like “throw away”), so I could end up having to do a lot more queries than word in the text.

Is there a better way to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T01:45:42+00:00Added an answer on May 20, 2026 at 1:45 am

    Wouldn’t this be better modelled as as normalised schema:

    Word Table:
        id        int(11) 
        word      varchar(50) 
    
    Synonym Table
        WordId     int(11)
        SynonymId  int(11)
    

    The synonyms for a word are then, for instance:

    Select W2.Word 
    from SynonymTable S
    join WordTable W on S.WordId = W.Id
    join WordTable W2 on S.SynonymId = W2.Id
    where W.word = 'slake' 
    

    Create an indexes on WordTable(Word), SynonymTable(WordId) and SynonymTable(SynonymId)

    There are several reasons for using this approach:

    • Flexible: No limit of number of synonyms per word
    • Efficient: Due to normalisation, the Row sizes are very small, so many rows fit into each database page, making more pages fit into available memory
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on web content filtering where there is 10000 of words coming
I'm working on a site that allows users to purchase digital content and have
i am using codeigniter 2.1.0 and mysql database. in my admin panel i have
want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's
working on a content provider and I'm having an issue with it. When I
I am working on a content management application in which the data being stored
I am working on a content management system for updates where the administrator can
I dont knwo why the Jquery fade in is not working for my content
The Content Assist in Eclipse 3.4 and 3.5 has stopped working for me. When
Currently I'm working on to display Epub content in UIWebview . From this link

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.