Class: TWPipeline::Stages::Normalize
- Inherits:
-
MapStage
- Object
- TWPipeline::Stage
- MapStage
- TWPipeline::Stages::Normalize
- Defined in:
- lib/twpipeline/stages/normalize.rb,
sig/twpipeline.rbs
Constant Summary
Constants inherited from TWPipeline::Stage
Instance Attribute Summary
Attributes inherited from TWPipeline::Stage
Instance Method Summary collapse
Methods inherited from MapStage
Methods inherited from TWPipeline::Stage
#call, #drop?, #flag, #initialize, lookup, order, ordered, register, #reject, slug
Constructor Details
This class inherits a constructor from TWPipeline::Stage
Instance Method Details
#transform(record) ⇒ Object
8 9 10 11 12 |
# File 'lib/twpipeline/stages/normalize.rb', line 8 def transform(record) original = record.fetch(:text, "") normalized = TWFilter.normalize(original, collapse_repeats: .fetch(:collapse_repeats, true)) record.merge(text: normalized, normalized: normalized != original) end |