I need to add a routine to an existing php script that will take two strings and identify groups of three or more words in the second that are the same as in the first, but ignoring any punctuation. So, for example, the two input strings might be:
Text comparison PHP code needed
5
I need to add a routine to an existing php script that will take two strings and identify groups of three or more words in the second that are the same as in the first, but ignoring any punctuation.
So, for example, the two input strings might be:
1. Here is a string of text that is being examined.
2. This string of text is being compared to the other.
And the output would be 'string of text'.
Also, with these two strings:
1. Let's look at things a different way (and add some punctuation); then compare.
2. Now we can look at things differently, by adding some punctuation - then comparing.
The output would be 'look at things' and 'some punctuation - then'.
So the punctuation is effectively ignored in both strings, but preserved in the output from the second string.
I hope all that makes sense!
Martin
So, for example, the two input strings might be:
1. Here is a string of text that is being examined.
2. This string of text is being compared to the other.
And the output would be 'string of text'.
Also, with these two strings:
1. Let's look at things a different way (and add some punctuation); then compare.
2. Now we can look at things differently, by adding some punctuation - then comparing.
The output would be 'look at things' and 'some punctuation - then'.
So the punctuation is effectively ignored in both strings, but preserved in the output from the second string.
I hope all that makes sense!
Martin
- Brandon Tanner
- Valdor Kiebach
- octalsoftware
- sktthemes
Next Topics on Trending Feed
-
5