Ar-Stemmer is pure Ruby port of Arabic Stemmer from Lucene.
Add this line to your application's Gemfile:
gem 'ar-stemmer'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ar-stemmer
require 'ar-stemmer'
ArStemmer.stem("الدونات")
# =>
"دونات"
When you want to turn on/off the specific rules for your own purpose, you can pass the name to only/except
option.
ArStemmer.stem(word, only: [:alef_lam, :waw_alef_lam])
ArStemmer.stem(word, except: [:yeh_noon, :waw_noon])
You can find the rule names in the source code.
The gem is available as open source under the terms of the MIT License.