Re: Porter extension cleaned up
| From: | Andrei Zmievski | Date: | Wed, 05 Dec 2001 15:47:11 +0000 |
| Subject: | Re: Porter extension cleaned up | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-72629@lists.php.net to get a copy of this message | ||
On Wed, 05 Dec 2001, J Smith wrote:
>
> After seeing my name in lights on the weekly PHP summary, I decided to go
> back into that Porter extension I had wrote about earlier and clean things
> up a bit.
>
> I stripped out all of the C++ stuff to make it a bit of an easier fit with
> PHP's C code (and it seems to be running slightly faster to boot).
>
> For now, it can only stem English language words, but after reading some
> interesting work by Dr. Porter at snowball.sourceforge.com, I'm thinking
> I'll start adding more languages soon. (Most notably, since I work on a
> Canadian web application, Francais is forthcoming.)
>
> For now, the prototype of the lone function in the extension is
>
> string porter(string word)
>
> which takes a word, uppercases it, removes and suffixes and returns the
> word's stem, or "-1" on any sort of failure. (I'm thinking just to return
> the word itself, uppercased and unchanged if there's some sort of failure
> -- comments?)
Why not return FALSE?
-Andrei
"This isn't right. This isn't even wrong."
-- Wolfgang Pauli