Class: PragmaticSegmenter::BetweenPunctuation
- Inherits:
-
Object
- Object
- PragmaticSegmenter::BetweenPunctuation
- Defined in:
- lib/pragmatic_segmenter/between_punctuation.rb
Overview
This class searches for punctuation between quotes or parenthesis and replaces it
Direct Known Subclasses
Languages::Deutsch::BetweenPunctuation, Languages::Japanese::BetweenPunctuation
Constant Summary collapse
- BETWEEN_SINGLE_QUOTES_REGEX =
Rubular: rubular.com/r/2YFrKWQUYi
/(?<=\s)'(?:[^']|'[a-zA-Z])*'/- BETWEEN_DOUBLE_QUOTES_REGEX =
Rubular: rubular.com/r/3Pw1QlXOjd
/"(?>[^"\\]+|\\{2}|\\.)*"/- BETWEEN_QUOTE_ARROW_REGEX =
Rubular: rubular.com/r/x6s4PZK8jc
/«(?>[^»\\]+|\\{2}|\\.)*»/- BETWEEN_QUOTE_SLANTED_REGEX =
Rubular: rubular.com/r/JbAIpKdlSq
/“(?>[^”\\]+|\\{2}|\\.)*”/- BETWEEN_SQUARE_BRACKETS_REGEX =
Rubular: rubular.com/r/WX4AvnZvlX
/\[(?>[^\]\\]+|\\{2}|\\.)*\]/- BETWEEN_PARENS_REGEX =
Rubular: rubular.com/r/6tTityPflI
/\((?>[^\(\)\\]+|\\{2}|\\.)*\)/
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text:) ⇒ BetweenPunctuation
constructor
A new instance of BetweenPunctuation.
- #replace ⇒ Object
Constructor Details
#initialize(text:) ⇒ BetweenPunctuation
Returns a new instance of BetweenPunctuation.
26 27 28 |
# File 'lib/pragmatic_segmenter/between_punctuation.rb', line 26 def initialize(text:) @text = text end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
25 26 27 |
# File 'lib/pragmatic_segmenter/between_punctuation.rb', line 25 def text @text end |
Instance Method Details
#replace ⇒ Object
30 31 32 |
# File 'lib/pragmatic_segmenter/between_punctuation.rb', line 30 def replace sub_punctuation_between_quotes_and_parens(text) end |