Ruby-Stemmer exposes SnowBall API to Ruby
Project Website:
Github Link:
Description
This package includes libstemmer_c library released under BSD licence and available for free here.
Support for latin language is also included and it has been generated with the snowball compiler using schinke contribution.
For more details about libstemmer_c please visit the SnowBall website.
Usage
require ‘rubygems’
require ‘lingua/stemmer’
stemmer= Lingua::Stemmer.new(:language => “ro”)
stemmer.stem(“netăgăduit”) #=> netăgădu
Alternative
require ‘rubygems’
require ‘lingua/stemmer’
Lingua.stemmer( %w(incontestabil neîndoielnic), :language => “ro” ) #=> [“incontest”, “neîndoieln”]
Lingua.stemmer(“installation”) #=> “instal”
Lingua.stemmer(“installation”, :language => “fr”, :encoding => “ISO_8859_1”) do | word |
puts “~> #{word}” #=> “instal”
end # => #
Rails
# Rails2: — config/environment.rb:
config.gem ‘ruby-stemmer’, :version => ‘>=0.6.2’, :lib => ‘lingua/stemmer’
# Rails3: — Gemfile
gem ‘ruby-stemmer’, ‘>=0.8.3’, :require => ‘lingua/stemmer’