Skip to main content
Notice removed Draw attention by Nagaraju
Bounty Ended with Frank's answer chosen by Nagaraju
Tweeted twitter.com/StackProgrammer/status/764002381373640705
Notice added Draw attention by Nagaraju
Bounty Started worth 50 reputation by Nagaraju
deleted 4 characters in body
Source Link
Tulains Córdova
  • 39.6k
  • 13
  • 102
  • 157

I will try to explain my objective with an example which will be easier to understand.

Suppose I have a sentence like "A B C D E F G H".(Each word seperated using single space).

I have a Database like:

B C D E

A B

F G

C D E F G

..

I need to find the maximum number of units from the Databasedatabase that match the sentence.The The outcome should be as such that C"C D E F GG" should be disocvered first instead of B"B C D EE" and aferafter finding C"C D E F GG" only the remaining part of the sentence should be matched with Databaseagainst the database. Any change/suggestion in my process are acceptedis welcomed.

The maximammaximum match units can be anywhere in the sentence.The problem here is that I could not come up with an algorithm which I can accomplish mythis task.

I will try to explain my objective with an example which will be easier to understand.

Suppose I have a sentence like "A B C D E F G H".(Each word seperated using single space).

I have a Database like:

B C D E

A B

F G

C D E F G

..

I need to find the maximum number of units from the Database that match the sentence.The outcome should be as such that C D E F G should be disocvered first instead of B C D E and afer finding C D E F G only the remaining part of the sentence should be matched with Database. Any change/suggestion in my process are accepted.

The maximam match units can be anywhere in the sentence.The problem here is that I could not come up with an algorithm which I can accomplish my task.

I will try to explain my objective with an example which will be easier to understand.

Suppose I have a sentence like "A B C D E F G H".(Each word seperated using single space).

I have a Database like:

B C D E

A B

F G

C D E F G

..

I need to find the maximum number of units from the database that match the sentence. The outcome should be such that "C D E F G" should be disocvered first instead of "B C D E" and after finding "C D E F G" only the remaining part of the sentence should be matched against the database. Any change/suggestion is welcomed.

The maximum match units can be anywhere in the sentence.The problem here is that I could not come up with an algorithm which can accomplish this task.

Source Link

Algorithm to find maximum matched units

I will try to explain my objective with an example which will be easier to understand.

Suppose I have a sentence like "A B C D E F G H".(Each word seperated using single space).

I have a Database like:

B C D E

A B

F G

C D E F G

..

I need to find the maximum number of units from the Database that match the sentence.The outcome should be as such that C D E F G should be disocvered first instead of B C D E and afer finding C D E F G only the remaining part of the sentence should be matched with Database. Any change/suggestion in my process are accepted.

The maximam match units can be anywhere in the sentence.The problem here is that I could not come up with an algorithm which I can accomplish my task.