Class: Translator::Cleaner

Inherits:
Step
  • Object
show all
Defined in:
lib/natural-date/translator/cleaner.rb

Instance Attribute Summary

Attributes inherited from Step

#language_bundle

Instance Method Summary collapse

Instance Method Details

#map(tokens, reference_date) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/natural-date/translator/cleaner.rb', line 3

def map tokens, reference_date
  tokens
    .strip
    .downcase
    .gsub('ç', 'c')
    .gsub('ã', 'a')
    .gsub('á', 'a')
    .gsub('ê', 'e')
    .gsub('é', 'e')
    .gsub(/,|\./, ' ')
    .split(/\s+/)
end