Pike function for choosing proper article for a word (a or an) ?

View: New views
8 Messages — Rating Filter:   Alert me  

Pike function for choosing proper article for a word (a or an) ?

by Michael Hartman-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there a default Pike function for choosing the proper article for a
word (a or an)?

If not, I'll write my own, but I always like to figure out if something
exists before I re-invent the wheel.


--
Michael A. Hartman, J.D.
President and CEO, Frogdice, Inc.
http://www.frogdice.com


Re: Pike function for choosing proper article for a word (a or an) ?

by Martin Stjernholm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Threshold <mlist@...> wrote:

> Is there a default Pike function for choosing the proper article for
> a word (a or an)?

I'm pretty sure there isn't.

Afaik the natural language tools are pretty much limited to this one:

> String.implode_nicely(({"a", "b", "c"}));
(2) Result: "a, b and c"
> String.implode_nicely(({"a", "b", "c"}), "or");
(3) Result: "a, b or c"


Re: Pike function for choosing proper article for a word (a or an) ?

by Martin Stjernholm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Martin Stjernholm <mast@...> wrote:

> Afaik the natural language tools are pretty much limited to this
> one:
/.../

Have to correct myself on this. There is also some stuff in the
Locale.Language module to format date and numbers in various
languages. But I cannot find a function to choose "a" or "an" in there
either.


Re: Pike function for choosing proper article for a word (a or an) ?

by Henrik Grubbström-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 21 Sep 2009, Threshold wrote:

> Is there a default Pike function for choosing the proper article for a word
> (a or an)?
>
> If not, I'll write my own, but I always like to figure out if something
> exists before I re-invent the wheel.

AFAIK there is no such function in Pike, and it's nontrivial to make a
correct one, since the selection of a or an depends on the pronounciation
of the following word (ie not directly on whether the first character is a
consonant or not).

> --
> Michael A. Hartman, J.D.

--
Henrik Grubbström grubba@...
Roxen Internet Software AB

Re: Pike function for choosing proper article for a word (a or an) ?

by Michael Hartman-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Martin Stjernholm wrote:

>> String.implode_nicely(({"a", "b", "c"}));
>>    
> (2) Result: "a, b and c"
>  
>> String.implode_nicely(({"a", "b", "c"}), "or");
>>    
> (3) Result: "a, b or c"
>
>
>  

Funny you should mention that function. It always vexed me, since to me
"nicely" would be:

a, b, and c

a, b, or c

Thanks for the response.



--
Michael A. Hartman, J.D.
President and CEO, Frogdice, Inc.
http://www.frogdice.com


Re: Pike function for choosing proper article for a word (a or an) ?

by pragmatk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Threshold wrote:
> Funny you should mention that function. It always vexed me, since to me
> "nicely" would be:
>
> a, b, and c
>
> a, b, or c

And so the Oxford comma debate emerges @ the Pike mailing-list
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)

iQIcBAEBAgAGBQJKt444AAoJEBoJnpcyPHg3sVYP+QGvsuAvmtjvyr+/SUhVoWGP
hA66R0Gy/Pbz1aVlgisDOgSKhSfQaMAZxtt2BsmWZJ/9bfrBf98gYrQF+Us6GGm/
TS+j5o2Noih2/Nj7b5UDmO/021C6wYadf50aWzwlb/ownklBgSkvJlm6X1u0I/6s
3pskyV3QZrKKoQ2/AnckKV364Bp0mJw7GXPHmY0vTd6LNYVjY522JGaCt0o05Ycf
grQtaByaOisCnQeZ5MBqV0cR2/lOjfkECyUHNqVOGLWPED9MMGokNjmLv3Nk7m8E
1G+ErsewUptpXiikEh1PShH7fK96IbfZ0LrSnyVY5jJEM9a0TBLRpcIDTe5XjUl0
5R7cC4GmRAKnNj30qc6PrTij8prqGnzcxkPeDhhlJNMqiq8TrlY12knOfvJYkf6W
+T7Jxsymdo/9qfJ40j28+kzDq3D3lWDPIuzc+4Su/ardk4s1Cq5K6ydIHpYyG1Gi
MhhNpZZx9bZm/mxYIPvtvatdxvlxdQ0IHShDLyq9c9rd1hvTEZ0WU39P3UHMGyre
UpUSadPt8y62O9HRXVEjm5G2M903dKMc91/VRYUTZkg5DDnbVg36lcdfdKrxrnTG
rgCIXzXxZfn0rKAypGfSds5SngcYKimfVa1rX6mwqWR3+lMnfiIs3giimdimG9v7
sB2m7FF4HPGCYqRBHpeT
=wC6m
-----END PGP SIGNATURE-----


Re: Pike function for choosing proper article for a word (a or an) ?

by James Harton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> And so the Oxford comma debate emerges @ the Pike mailing-list


It's not so much a debate as a localisation issue.  en_NZ has no  
serial comma.

---
James Harton
http://www.mashd.cc/ | http://www.helicopter.geek.nz/


Re: Pike function for choosing proper article for a word (a or an) ?

by Bill Welliver :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It's a shame the localization gods didn't give us the ability to choose
which style guide we want our app to follow :)

Sadly, there's no such unity among en_US and en_GB, with the newspaper
style guides omitting the "oxford comma" and the others recommending its
use. I think the reality is more subtle: use it when it reduces ambiguity
and omit it when it doesn't.

I'll just stick to working on my pluralization/singularization code...

Isn't english grand?

Bill

On Tue, 22 Sep 2009, James Harton wrote:

>> And so the Oxford comma debate emerges @ the Pike mailing-list
>
>
> It's not so much a debate as a localisation issue.  en_NZ has no serial
> comma.
>
> ---
> James Harton
> http://www.mashd.cc/ | http://www.helicopter.geek.nz/