Re: Generating Keywords from text

From: Date: Fri, 26 Jul 2002 10:27:41 +0000
Subject: Re: Generating Keywords from text
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-109696@lists.php.net to get a copy of this message
That part is easy(split each one into an array variable using explode on spaces). The problem is getting a relevancy rating for each keyword and only putting it into the database once. Has anyone done this or have any ideas?
I will think i would do something like this... <?php $Words = explode(" ", $yourtext); $IgnoreWords = array("the", "and", "is", "are", "then"); //... $WordsCount = array_count_values($Words); $WordsCountKeys = array_keys($WordsCount); foreach($WordsCountKeys as $x) { if(!in_array($x, $IgnoreWords)) {
     if($WordsCount[$x] >= 2) { //word in text 2 times or more
        //add to keywords
     }
} } ?> Maybe this can help you the first way? Maybe there is some errors... im hungry... so I will go out eating :) Regards, Johan

« previous php.general (#109696) next »