Re: Porter extension cleaned up
| From: | J Smith | Date: | Wed, 05 Dec 2001 17:23:41 +0000 |
| Subject: | Re: Porter extension cleaned up | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-72659@lists.php.net to get a copy of this message | ||
It probably will, 'cause that makes much more sense. Originally it just
returned a string containing "-1" back when it wasn't a PHP extension, when
it was just a C++ library, and you know how much C++ loves strong typing.
But that isn't the case now, so returning false now to PHP would make more
sense.
J
Andrei Zmievski wrote:
> 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