Sha256: 3bacf4ed92fe4e19ba4c15b0e25049409d6e36ae17f38ddbd80a3589142ca6ee

Contents?: true

Size: 448 Bytes

Versions: 1

Compression:

Stored size: 448 Bytes

Contents

module Sastrawi
  module StopWordRemover
    class StopWordRemover
      attr_accessor :dictionary

      def initialize(dictionary)
        @dictionary = dictionary
      end

      def remove(text)
        words = text.split(' ')
        stop_words = []

        words.each do |word|
          unless @dictionary.include?(word)
            stop_words.push(word)
          end
        end

        stop_words.join(' ')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sastrawi-0.1.0.pre lib/sastrawi/stop_word_remover/stop_word_remover.rb