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.
14 15 16 |
# File 'lib/pragmatic_segmenter/processor.rb', line 14 def text @text end |
Instance Method Details
#process(text:) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/pragmatic_segmenter/processor.rb', line 19 def process(text:) @text = List.new(text: text).add_line_break replace_abbreviations replace_numbers replace_continuous_punctuation @text.apply(@language::Abbreviations::WithMultiplePeriodsAndEmailRule) @text.apply(@language::GeoLocationRule) split_into_segments end |