Module: CloudText

Defined in:
lib/cloud_text.rb,
lib/cloud_text/version.rb

Constant Summary collapse

MAJOR =
0
MINOR =
1
TINY =
1
VERSION =

PRE = nil

[MAJOR, MINOR, TINY].compact.join('.')

Class Method Summary collapse

Class Method Details

.clean_text(input, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cloud_text.rb', line 8

def self.clean_text(input, options = {})
  @input = input
  @options = options

  # Get feature on/off switches
  remove_digits = @options.fetch(:remove_digits, false)
  stemming_enabled = @options.fetch(:stemming, false)

  # Get variables
  @language = @options.fetch(:language, "en")
  @custom_stopwords = @options.fetch(:stopwords, [])

  @input = process_text(@input, stemming_enabled, remove_digits, @language, @custom_stopwords)
  count_words(@input)
end