English is a collection English-related text manipulation and natural language processing libraries for the Ruby programming language. Over time the project hopes to provide a fairly comprehensive set of tools for working with English language data.
Probably the most typical example of it use is:
require 'english/inflect' "boy".en.plural #=> "boys" "boys".en.singular #=> "boy" "ox".en.plural #=> "oxen" "oxen".en.singular #=> "ox"
By default the $language
global variable is set to 'en'
.
If the english/mixin
library is loadeds the #en
method call
can be left out and the same result achieved.
require 'english/mixin' "boy".plural #=> "boys" "boys".singular #=> "boy" "ox".plural #=> "oxen" "oxen".singular #=> "ox"
English includes many other useful methods and also a few useful classes.
Each library can be utilized independently. Or all libraries can be loaded with
the single require
.
require 'english'
For more details see the Wiki or the RDoc API documentation.