Hello,
I have a question currently i'm programming a function to remove duplicates
from an array of sentences.
The computer must classify sentences with exactly the same words in it, but
with a different sequence as a duplicate.
The array that i use as a feed is as following:
$sentences[] = "this is a example sentence";
$sentences[] = "a this is example sentence";
$sentences[] = "example this is a sentence";
$sentences[] = "this is a example sentence for a function";
I want the computer to keep only two records of the sentence array in this
case (0|1|2) and 3
I made the script as following:
function($sentences) {
foreach($sentences as $sentence) {
$words = explode(" ",$sentence);
$sentenceArray[] = $words;
}
foreach(sentenceArray as $sentence) {
// Here i want the same words are in other sentences
}
}
My question is how could i check the $sentence array if there are records in
it with exactly the same words
as my feed?