Class: PragmaticSegmenter::Processor
- Inherits:
-
Object
- Object
- PragmaticSegmenter::Processor
- Defined in:
- lib/pragmatic_segmenter/processor.rb
Overview
This class processing segmenting the text.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(language: Languages::Common) ⇒ Processor
constructor
A new instance of Processor.
- #process(text:) ⇒ Object
Constructor Details
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
16 17 18 |
# File 'lib/pragmatic_segmenter/processor.rb', line 16 def text @text end |
Instance Method Details
#process(text:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pragmatic_segmenter/processor.rb', line 21 def process(text:) @text = List.new(text: text).add_line_break replace_abbreviations replace_numbers replace_continuous_punctuation replace_periods_before_numeric_references Rule.apply(@text, @language::Abbreviations::WithMultiplePeriodsAndEmailRule) Rule.apply(@text, @language::GeoLocationRule) Rule.apply(@text, @language::FileFormatRule) split_into_segments end |