RubyConf: Speak My Language

Michael Granger gave a RubyConf 2006 presentation on Natural Language Processing and Natural Language Generation in Ruby. Michael gave some interesting demos where he was able to break a sentence into its grammatical building blocks such as subject, verb, and noun. He was also able to translate a sentence into a more generic version of itself. This session was a personal favorite although I don’t have a current need for language processing libraries.

Here is a list of Ruby libraries which Michael recommends:
Stemmable – an implementation of Porter Stemming Algorithm.
Chronic – a natural language date/time parser written in pure Ruby.
Ruby WordNet – Ruby WordNet is a Ruby interface to the WordNet Lexical Database.
Ruby LinkParser – Ruby port of the perl module Lingua::LinkParser used to determine the structure of a sentence.
Ruby Linguistics – A Ruby framework that integrates Ruby WordNet, Ruby LinkParser. Here is some code of Ruby Linguistics in use:

require ‘linguistics’
Linguistics::use(:en) # extends Array, String, and Numeric

# Pluralization
puts “box”.en.plural # => “boxes”
puts “mouse”.en.plural # => “mice”

# Present Participles
“runs”.en.present_participle # => “running”
“eats”.en.present_participle # => “eating”

# Ordinal Numbers
puts 5.en.ordinal # => “5th”
puts 2004.en.ordinal # => “2004th”

# Quantification
puts “cow”.en.quantify(5) # => “several cows”
puts “cow”.en.quantify(1005) # => “thousands of cows”

Technorati Tags: , , , , , , , ,

Leave a Reply