Keywords from String

Does anyone know of a PHP function available that takes a piece of text, say a few hundred words, and creates an array of keywords? I.e. the most important, frequently encountered unique terms?

Thanks Philip

+2


source to share


2 answers


There is no such function (it would be magical if it were), but to start something, you could do the following:



+7


source


Something like this might do the trick:

$thestring = 'the most important, frequently occuring unique terms?';
$arrayofwords = explode(" ", $thestring);
echo print_r($arrayofwords);

      



You can also replace the comma "," with a space so that 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);

      

0


source







All Articles