Ruby Linguistics
Published 11 October 06 by Justin French, 3 comments
Gruber just pointed me in the direction of a very nice Ruby module called Linguistics by Michael Granger and Martin Chase.
Of course it does the usual stuff like plurals, but it’s the Quantifications and Conjunctions that really grabbed my attention.
This:
animals = %w{dog cow ox chicken goose goat cow dog rooster llama pig goat dog cat cat dog cow goat goose goose ox alpaca}
puts "The farm has: " + animals.en.conjunction
Outputs:
The farm has: four dogs, three cows, three geese, three goats, two oxen, two cats, a chicken, a rooster, a llama, a pig, and an alpaca
Thoroughly impressed.
Before you go…
Here’s some links to my most popular posts: