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::Chinese::BetweenPunctuation, Languages::Deutsch::BetweenPunctuation, Languages::Japanese::BetweenPunctuation
Constant Summary collapse
- BETWEEN_SINGLE_QUOTES_REGEX =
Rubular: rubular.com/r/2YFrKWQUYi
/(?<=\s)'(?:[^']|'[a-zA-Z])*'/
- BETWEEN_SINGLE_QUOTE_SLANTED_REGEX =
/(?<=\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}|\\.)*\)/
- WORD_WITH_LEADING_APOSTROPHE =
Rubular: rubular.com/r/mXf8cW025o
/(?<=\s)'(?:[^']|'[a-zA-Z])*'\S/
- BETWEEN_EM_DASHES_REGEX =
Rubular: rubular.com/r/jTtDKfjxzr
/\-\-(?>[^\-\-])*\-\-/
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.
35 36 37 |
# File 'lib/pragmatic_segmenter/between_punctuation.rb', line 35 def initialize(text:) @text = text end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
34 35 36 |
# File 'lib/pragmatic_segmenter/between_punctuation.rb', line 34 def text @text end |
Instance Method Details
#replace ⇒ Object
39 40 41 |
# File 'lib/pragmatic_segmenter/between_punctuation.rb', line 39 def replace sub_punctuation_between_quotes_and_parens(text) end |