👋 This project started in 2008 mostly as a mean for me to learn how to build C extensions to ruby, exposing a library at that time I needed to use in a real life project. It’s 2022 and many things changed since. Most important is my lack of time to keep up with recent libstemmer_c versions and releasing builds compatible with various versions of Windows.
With this in mind, it is fair to archive this project.
Ruby-Stemmer exposes SnowBall API to Ruby.
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.
require 'rubygems' require 'lingua/stemmer' stemmer= Lingua::Stemmer.new(:language => "ro") stemmer.stem("netăgăduit") #=> netăgădu
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 # => #<Lingua::Stemmer:0x102501e48>
gem 'ruby-stemmer', '>=2.0.0', :require => 'lingua/stemmer'
-
Complete API in RDoc format
-
More usage on the test file
gem install ruby-stemmer
There’s also a Windows (Fat bin)
gem install ruby-stemmer --platform=x86-mingw32
As far as I know the above should work with rubyinstaller. If it fails, you could try with:
gem install ruby-stemmer --platform=x86-mswin32
It’s known to work under Windows XP.
$ git clone git://github.com/aurelian/ruby-stemmer.git $ cd ruby-stemmer $ rake -T #<== see what we've got $ rake compile #<== builds the extension do'h $ rake test
Install rake-compiler-dock and follow the setup.
Then, inside the docker image:
$ AR=i686-w64-mingw32-ar CC=i686-w64-mingw32-gcc LD=i686-w64-mingw32-ld rake cross native gem
Or, build the lib first then compile:
$ cd libstemmer_c $ AR=i686-w64-mingw33-ar CC=i686-w64-mingw32-gcc LD=i686-w64-mingw32-ld make $ cd ../ $ rake cross native gem
The stemming process is an algorithm to allow one to find the stem of an word (not the root of it). For further reference on stem vs. root, please check wikipedia articles on the topic:
-
Fork the project from github
-
Make your feature addition or bug fix
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history.
if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull
-
Send me a pull request. Bonus points for topic branches.
-
stemmer4r (ext)
-
fast-stemmer (ext)
-
uea-stemmer (ext)
-
stemmer (pure ruby)
-
add yours
Copyright © 2008-2020 Aurelian Oancea. See MIT-LICENSE for details.
-
Yury Korolev - various bug fixes
-
Aaron Patterson - rake compiler (windows support), code cleanup
-
Damián Silvani - Ruby 1.9 encoding
# encoding: utf-8