class FarsiProcessor
Constants
- VERSION
Attributes
excepts[R]
onlys[R]
options[R]
word[R]
Public Class Methods
new(word, options = {})
click to toggle source
# File lib/farsi_processor.rb, line 23 def initialize(word, options = {}) @word = word @options = options @onlys = [] @excepts = [] if options[:only] @onlys = options[:only] elsif options[:except] @excepts = options[:except] end end
normalize(word, options = {})
click to toggle source
# File lib/farsi_processor.rb, line 13 def self.normalize(word, options = {}) new(word, options).normalize end
process(word, options = {})
click to toggle source
# File lib/farsi_processor.rb, line 9 def self.process(word, options = {}) new(word, options).process end
stem(word, options = {})
click to toggle source
# File lib/farsi_processor.rb, line 17 def self.stem(word, options = {}) new(word, options).stem end
Public Instance Methods
process()
click to toggle source
# File lib/farsi_processor.rb, line 36 def process normalize stem end
Private Instance Methods
filter_rules(group)
click to toggle source
# File lib/farsi_processor.rb, line 43 def filter_rules(group) if excepts.any? group.reject { |k, _v| excepts.include?(k) } elsif onlys.any? group.select { |k, _v| onlys.include?(k) } else group end end