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

  • SEARCH
  • Home
  • 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 515449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:37:46+00:00 2026-05-13T07:37:46+00:00

I have a database table with around 1000 keywords/phrases (one to four words long)

  • 0

I have a database table with around 1000 keywords/phrases (one to four words long) – This table changes rarely, so I could extract the data into something more useful (like a regular expression?) – So this is not finding / guessing at keywords based on natural language processing..

I then have a user inputting some text into a form that I’d like to match against my keywords and phrases.

The program would then store a link to each phrase matched next to the text.

So if we ran the algorithm on this question text against a few phrases that are in here, we’d get a result like so:

{"inputting some text" : 1,
 "extract the data" : 1,
 "a phrase not here" : 0}

What are my options?

  1. Compile a regular expression
  2. Some sort of SQL query
  3. A third way?

Bearing in mind that there’s a 1000 possible phrases..

I’m running Django / Python with MySQL.

edit: I’m currently doing this:

>>> text_input = "This is something with first phrase in and third phrase" 
>>> regex = "first phrase|second phrase|third phrase" 
>>> p = re.compile(regex, re.I) 
>>> p.findall(text_input)
['first phrase','third phrase']
  • 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-13T07:37:46+00:00Added an answer on May 13, 2026 at 7:37 am

    The algorithm for this job is Aho-Corasick … see the link at the bottom whch points to a C-extension for Python.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have database table like this +-------+--------------+----------+ | id | ip | date |
I have one database table which contains 8 columns. One of the columns is
I have a database table using an enum. This is already working with hibernate
i have around 1000 of rows in database which i want to divide in
My use case is as follows -- I have a database table with around
We have an Oracle 11g database table with around 35 million rows. We are
I have an Access database which has a table with around 6k records. When
I have a database table like this Port Code | Country |Port_Name -------------------------------------- 1234
Okay, so let's say I have a mysql database table with two columns, one
we have a database table which has around 200,000 records. which includes 3 ntext

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.