Is there a way to programmatically match plural words using Treetop. The Linguistics gem will pluralize a word, but how can that be inserted back into the parser.
Here's an example of what I'm trying to do:
#!/usr/bin/env ruby
require 'treetop'
require 'linguistics'
include Linguistics::EN
Treetop.load_from_string DATA.read
parser = RecipeParser.new
p parser.parse('cans')
__END__
grammar Recipe
rule units
unit &{|s| plural(s[0].text_value) }
end
rule unit
'can'
end
end