RubyPulse Episode 0.25 - linguistics

.. a generic, language-neutral framework for extending Ruby objects with linguistic methods. - Michael Granger, Martin Chase

> 4.to_s
=> "4"
> require 'rubygems'
=> true
> require 'linguistics'
=> true
> Linguistics::use( :en )
=> [String, Numeric, Array]
> 4.en.numwords
=> "four"
> 44.en.numwords
=> "forty-four"
> 444.en.numwords
=> "four hundred and forty-four"
> 444.en.numwords :and => " "
=> "four hundred forty-four"
> "mouse"
=> "mouse"
> "mouse".en.plural
=> "mice"
> 44.en.ordinal
=> "44th"
> 41.en.ordinal
=> "41st"
> 42.en.ordinal
=> "42nd"
> "mouse".en.a
=> "a mouse"
> "mouse".en.plural.en.a
=> "a mice"
> 2385762345876.en.numwords
=> "two trillion, three hundred and eighty-five billion, seven hundred and sixty-two million, three hundred and forty-five thousand, eight hundred and seventy-six"
> 2385762345876.en.numwords :and => " "
=> "two trillion, three hundred eighty-five billion, seven hundred sixty-two million, three hundred forty-five thousand, eight hundred seventy-six"
> "mouse".en.quantify 10
=> "a number of mice"
> "mouse".en.quantify 100
=> "hundreds of mice"
> "mouse".en.quantify 1000
=> "thousands of mice"
> "mouse".en.quantify 1111
=> "thousands of mice"


Links for this episode

homepage of linguistics

Tags : linguistics, ruby

Download (11.5 MB, 4:57)
Alternative download for iPod and iPhone (6.3 MB, 4:57)
Powered by Olark