You could probably do something like this assuming the array $data contains your original info and the other array $list contains all unique words.
for ($i=0; $i<length($data); $i++) {
$found = 0;
for ($j=0; $j<length($list); j++) {
if ($data[$i] == $list[j]) {
$found = 1;
break;
}
}
if (!$found) {
$list[] = $data[$i];
}
}
you could add a way to keep count if you want to as well, but this should give all unique words assuming no punctuation or special characters.