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 6553203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:33:13+00:00 2026-05-25T12:33:13+00:00

I know how to compare two texts and get all the single words that

  • 0

I know how to compare two texts and get all the single words that appear in both. But how can I match expressions/phrases?

For example:
1. “This is the computer maker Apple”
2. “Apple is a California based great computer maker”

Now 🙂

  1. Apple is clearly present in both.

  2. computer and maker are present in both. I could check at this point if they are a group of words(one follows the other one).

But for the speed of processing, isn’t there a way to match “computer maker” and not each one and then check if present as a group.

Keep in mind that the example given is trivial and just for the purpose of exemplifying, in practice more complicated sentences/texts may be presented.

  • 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-25T12:33:14+00:00Added an answer on May 25, 2026 at 12:33 pm

    You could parse both strings and split on whitespace to get token arrays A1 and A2. Then, simply check every contiguous subsequence in A1 for a matching one in A2. This looks like O(n^4) to me, which is better than getting all the single matches and looking for combinations… which is not polynomial.

      1. the cat is on the roof
      2. a man is on the stage
    
      A1 = [the, cat, is, on, the, roof]
      A2 = [a, man, is, on, the, stage]
    
      [the]: no match
      [cat]: no match
      [is]: match
      [is, on]: match
      [is, on, the]: match
      [is, on, the, roof]: no match
      [on]: match
      [on, the]: match
      [on, the, roof]: no match
      [the]: match
      [the, roof]: no match
      [roof]: no match
      -end-
    

    Recursion seems like an elegant way to implement something like this. If you need something more efficient, I’m sure that there is a smarter way to do it than this.

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

Sidebar

Related Questions

I know that I can use cmp, diff, etc to compare two files, but
I would like to know if there is anyway I can compare two columns
Does anyone know of a tool that can be used to compare (relatively complex)
As you all know Compare validators can be used to validate dates and check
I want to know if I can compare two consecutive jobs in Hadoop. If
I know that ISKINDOF() function is used to compare two class objects that is
I would like to compare two DataTables. All I need to know is are
I wanted to know how can I compare two rearranged strings E.g if String
We have a requirement in the project that we have to compare two texts
Does anyone know of a simple way to compare two strings together to generate

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.