Re: Porter Stemming Algorithm for PHP

From: Date: Sat, 16 Dec 2000 02:05:44 +0000
Subject: Re: Porter Stemming Algorithm for PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30639@lists.php.net to get a copy of this message
Hi - Looks good...I had played around with this a year or so ago, but your version looks a little neater than mine. One thing I was thinking about adding, though, was a word exception list - for instance, the standard Porter algorithm would turn 'waterbed' into 'waterb'. That wasn't a big problem for me, since I was dealing with a fairly limited vocabulary, but it could lead to some weird results with an unrestricted word list. I suppose a more generalized stemmer would be a cool addition to PHP's string functions, along with pspell, soundex/metaphone/levenshtein/similar_text funcs and all that, but I don't have any time in the near future to diddle with it...
        - steve
At 10:43 PM 12/14/00 , Joe Stump wrote:
Well since I was bored last night and a few people have asked about this on the list over the past few weeks I thought I would post it. It's a port of the Porter Stemming Algorithm to PHP. It conforms to the algorithm rather well. The calculation of $m (the number of times a CV pair happens in sequence after initial C and before ending V) needs to be worked on, but other than that it works well. What is the Porter Stemming Algorithm? Well it takes "interesting" and turns it into "interest", "running" into "run", etc. You can get it at the following address: http://www.miester.org/software/ I've done some arbitrary tests and was able to run the function on the word "interesting", on average, 450 times a second.
+------------------------------------------------------------------------+
| Steve Edberg                           University of California, Davis |
| sbedberg@ucdavis.edu                                     (530)754-9127 |
| http://aesric.ucdavis.edu/                  http://pgfsun.ucdavis.edu/ |
+---------------------- Gort, Klaatu barada nikto! ----------------------+

« previous php.general (#30639) next »