Class: FarsiProcessor
- Inherits:
-
Object
- Object
- FarsiProcessor
- Includes:
- Normalizer, Stemmer
- Defined in:
- lib/farsi_processor.rb,
lib/farsi_processor/version.rb
Constant Summary collapse
- VERSION =
"0.2.1"
Constants included from Stemmer
Stemmer::ALEF, Stemmer::GAF, Stemmer::HEH, Stemmer::MEEM, Stemmer::NOON, Stemmer::PLURAL_FORMS, Stemmer::REH, Stemmer::SUFFIXES, Stemmer::TET, Stemmer::YEH
Constants included from Normalizer
Normalizer::ALEF, Normalizer::ALEF_MADDA, Normalizer::ALEF_WITH_HAMZA_ABOVE, Normalizer::ALEF_WITH_HAMZA_BELOW, Normalizer::ARABIC_ALEF_MAKSOURA, Normalizer::ARABIC_KAF, Normalizer::ARABIC_YEH, Normalizer::CHARACTERS_MAPPINGS, Normalizer::DAMMA, Normalizer::DAMMATAN, Normalizer::DIACRITICS, Normalizer::FARSI_KEHEH, Normalizer::FARSI_YEH, Normalizer::FATHA, Normalizer::FATHATAN, Normalizer::KASRA, Normalizer::KASRATAN, Normalizer::SHADDA, Normalizer::SUKUN, Normalizer::TATWIL
Instance Attribute Summary collapse
-
#excepts ⇒ Object
readonly
Returns the value of attribute excepts.
-
#onlys ⇒ Object
readonly
Returns the value of attribute onlys.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#word ⇒ Object
readonly
Returns the value of attribute word.
Class Method Summary collapse
- .normalize(word, options = {}) ⇒ Object
- .process(word, options = {}) ⇒ Object
- .stem(word, options = {}) ⇒ Object
Instance Method Summary collapse
-
#initialize(word, options = {}) ⇒ FarsiProcessor
constructor
A new instance of FarsiProcessor.
- #process ⇒ Object
Methods included from Stemmer
Methods included from Normalizer
Constructor Details
#initialize(word, options = {}) ⇒ FarsiProcessor
Returns a new instance of FarsiProcessor.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/farsi_processor.rb', line 23 def initialize(word, = {}) @word = word @options = @onlys = [] @excepts = [] if [:only] @onlys = [:only] elsif [:except] @excepts = [:except] end end |
Instance Attribute Details
#excepts ⇒ Object (readonly)
Returns the value of attribute excepts.
21 22 23 |
# File 'lib/farsi_processor.rb', line 21 def excepts @excepts end |
#onlys ⇒ Object (readonly)
Returns the value of attribute onlys.
21 22 23 |
# File 'lib/farsi_processor.rb', line 21 def onlys @onlys end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
21 22 23 |
# File 'lib/farsi_processor.rb', line 21 def @options end |
#word ⇒ Object (readonly)
Returns the value of attribute word.
21 22 23 |
# File 'lib/farsi_processor.rb', line 21 def word @word end |
Class Method Details
.normalize(word, options = {}) ⇒ Object
13 14 15 |
# File 'lib/farsi_processor.rb', line 13 def self.normalize(word, = {}) new(word, ).normalize end |
.process(word, options = {}) ⇒ Object
9 10 11 |
# File 'lib/farsi_processor.rb', line 9 def self.process(word, = {}) new(word, ).process end |
.stem(word, options = {}) ⇒ Object
17 18 19 |
# File 'lib/farsi_processor.rb', line 17 def self.stem(word, = {}) new(word, ).stem end |
Instance Method Details
#process ⇒ Object
36 37 38 39 |
# File 'lib/farsi_processor.rb', line 36 def process normalize stem end |