Re: Generating Keywords from text
| From: | JJ Harrison | Date: | Fri, 26 Jul 2002 13:12:04 +0000 |
| Subject: | Re: Generating Keywords from text | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109713@lists.php.net to get a copy of this message | ||
I got it basicly working after a little bit of effort. Thank you.
BTW earth is repeated four times as earth and four times as earth's. How
could I get eight of earth instead of four? give me a function to research
and I will.
Now I will figure out how to get a fair weight.
--
JJ Harrison
webmaster@tececo.com
www.tececo.com
"Johan Holst Nielsen" <johan@1way2print.net> wrote in message
news:3D41241D.2030609@1way2print.net...
> > 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) { file://word in text 2 times or more
> file://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
>