Class: PragmaticSegmenter::PunctuationReplacer

Inherits:
Object
  • Object
show all
Defined in:
lib/pragmatic_segmenter/punctuation_replacer.rb

Overview

This class replaces punctuation that is typically a sentence boundary but in this case is not a sentence boundary.

Defined Under Namespace

Modules: Rules

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text:, matches_array:, match_type: nil) ⇒ PunctuationReplacer

Returns a new instance of PunctuationReplacer.



34
35
36
37
38
# File 'lib/pragmatic_segmenter/punctuation_replacer.rb', line 34

def initialize(text:, matches_array:, match_type: nil)
  @text = text
  @matches_array = matches_array
  @match_type = match_type
end

Instance Attribute Details

#match_typeObject (readonly)

Returns the value of attribute match_type.



33
34
35
# File 'lib/pragmatic_segmenter/punctuation_replacer.rb', line 33

def match_type
  @match_type
end

#matches_arrayObject (readonly)

Returns the value of attribute matches_array.



33
34
35
# File 'lib/pragmatic_segmenter/punctuation_replacer.rb', line 33

def matches_array
  @matches_array
end

#textObject (readonly)

Returns the value of attribute text.



33
34
35
# File 'lib/pragmatic_segmenter/punctuation_replacer.rb', line 33

def text
  @text
end

Instance Method Details

#replaceObject



40
41
42
# File 'lib/pragmatic_segmenter/punctuation_replacer.rb', line 40

def replace
  replace_punctuation(matches_array)
end