Class: Sastrawi::StopWordRemover::StopWordRemoverFactory
- Inherits:
-
Object
- Object
- Sastrawi::StopWordRemover::StopWordRemoverFactory
- Defined in:
- lib/sastrawi/stop_word_remover/stop_word_remover_factory.rb
Constant Summary collapse
- STOP_WORDS_FILE =
File.join(File.dirname(__FILE__), '..', '..', '..', 'data', 'stop-words.txt')
Instance Method Summary collapse
Instance Method Details
#create_stop_word_remover ⇒ Object
11 12 13 14 15 |
# File 'lib/sastrawi/stop_word_remover/stop_word_remover_factory.rb', line 11 def create_stop_word_remover stop_words = get_stop_word dictionary = Sastrawi::Dictionary::ArrayDictionary.new(stop_words) Sastrawi::StopWordRemover::StopWordRemover.new(dictionary) end |
#get_stop_word ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/sastrawi/stop_word_remover/stop_word_remover_factory.rb', line 17 def get_stop_word if File.exist?(STOP_WORDS_FILE) File.readlines(STOP_WORDS_FILE, chomp: true).reject(&:empty?) else default_stop_words end end |