Pages

Wednesday, May 9, 2007

1 cats, 2 cats

I just faced a pluralisation problem at work today.

I then realised that I had no tools to combat it.

Looking around I found a really good paper that I want to re-read (hence this post)
Algorithmic Approach to English Pluralisation

I thought spring hand some nice ways to handle it, but I can’t remember if I read it or just imagined it

Looks like I might be writing my own tool again.

-= Comments
1. Xavier | May 12th, 2007 at 4:22 pm
pluralize(2, “cat”)

Rails has this problem solved, if you’re writing java code yourself you could do worse than porting their code. There’s also a really neat library around for things like creating lists (”cats, dogs, and aeroplanes”), but I can’t recall its name.

2. Xavier | May 12th, 2007 at 4:24 pm
(check the “Inflector” class in the rails docs)

3. pimaster | May 12th, 2007 at 9:54 pm
Cool.
The only problem I foresee is that is an english only solution.
Java has message formatting via the usual
“I have {0} message”, 3
If I could have something like:
“I have {0} {message|messages}”, 3
I’d be a happy monkey

4. Xavier | May 13th, 2007 at 11:55 am
You can customize the Inflector class in your configuration for specific words it doesn’t know about (Ox -> Oxen), not sure if that solves your problem.

5. Andrew B Coathup | May 17th, 2007 at 8:27 pm
email is the singular and the plural. emails is not a word. Just thought this was a good place to have a wee rant.

Rant rant…

Ok, I am done now.

6. Hari | May 19th, 2007 at 8:22 pm
Of course emails is a word.

Which sounds better: "I sent you three emails yesterday” or “I sent you three email yesterday"?

No comments:

Post a Comment