Reputation: 675
Does anyone know of an available PHP function that takes a piece of text, with say a few hundreds of words long and produces an array of keywords? Ie. the most important, frequently occuring unique terms?
Thanks Philip
Upvotes: 2
Views: 533
Reputation: 342635
No such function exists (would be magical if it did) but to start something off, you could do the following:
preg_replace
).$words[0]
).Upvotes: 7
Reputation: 5766
Something like this might do the trick:
$thestring = 'the most important, frequently occuring unique terms?';
$arrayofwords = explode(" ", $thestring);
echo print_r($arrayofwords);
Also you may replacement the comma "," for a blank, so you get clean keywords.
$thestring = 'the most important, frequently occuring unique terms?';
$cleaned_string = str_replace(",", "", "$thestring");
$arrayofwords = explode(" ", $cleaned_string);
echo print_r($arrayofwords);
Upvotes: 0