Class: Sastrawi::Stemmer::Filter::TextNormalizer
- Inherits:
-
Object
- Object
- Sastrawi::Stemmer::Filter::TextNormalizer
- Defined in:
- lib/sastrawi/stemmer/filter/text_normalizer.rb
Class Method Summary collapse
Class Method Details
.normalize_text(text) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/sastrawi/stemmer/filter/text_normalizer.rb', line 5 def self.normalize_text(text) lowercase_text = text.downcase replaced_text = lowercase_text.gsub(/[^a-z0-9 -]/im, ' ') replaced_text = replaced_text.gsub(/( +)/im, ' ') replaced_text.strip end |