About
ruby-stemmer exposes SnowBall API stemmer implementation to ruby.
This package includes libstemmer_c library – released under BSD licence and available for download at: http://snowball.tartarus.org/dist/libstemmer_c.tgz.
For details about libstemmer_c please check libstemmer_c/README file or http://snowball.tartarus.org.
author: Aurelian Oancea, oancea at gmail.com
licence: MIT, see MIT-LICENSE file for details
Install
Please use sudo or run as root if you get in to Permission Deny issues.
Stable version – with rubygems:
$ gem install ruby-stemmer
Development version – from source
$ ruby extconf.rb # => compile libstemmer_c and generate a Makefile $ make # => compile the library $ ./test.rb # => test it :) $ make install # => to installUsage
Please refer to test.rb
.
API
module Lingua
class Steemer
# creates a new Steemer,
# defaults: language => en, encoding => UTF_8
# pass :language or :encoding to change them
def initialize
end
# stemms the word
def stem(word)
end
# gets the length of the last stemmed word
# same as:
# word = Lingua::Steemer.new.stem("installation") # ==> install (string)
# word.length # ==> 6 (int)
def length
end
end
end
Todo
- Add (Array of Hashes) Lingua::Stemmer.list to list available languages/encodings
- Windows?