On Wednesday 12 June 2002 05:00, Zac Hillier wrote:
> Hi All,
>
> I'm writing a search facility and am stripping noise words from a string
> (The string contains between 50 - 200 words). Presently I'm importing a
> text file of noise words (The noise words file contains almost 1000 words)
> then using :
>
>    #-- remove noisewords
>    $cntLmt = count($noise_words);
>    for ($i=0; $i<$cntLmt; $i++) {
>     $filterword = trim(strtolower($noise_words[$i]));
>     $filtered = preg_replace("/(\b$filterword \b)/x"," ",$filtered);
>    }
>
> to remove these noise words.
>
> However I'm wondering if it would be quicker to separate the $filtered
> string and then look for the words in a noise words string. If so how would
> I do this and remove the words?

Don't know whether it would be faster or not. You can use array_diff() to get 
only the words which are not noise words.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Spence's Admonition:
        Never stow away on a kamikaze plane.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to