Class: PragmaticSegmenter::Number
- Inherits:
-
Object
- Object
- PragmaticSegmenter::Number
- Defined in:
- lib/pragmatic_segmenter/number.rb
Overview
This class searches for numbers with periods within a string and replaces the periods.
Direct Known Subclasses
Constant Summary collapse
- PeriodBeforeNumberRule =
Rubular: rubular.com/r/oNyxBOqbyy
Rule.new(/\.(?=\d)/, '∯')
- NumberAfterPeriodBeforeLetterRule =
Rubular: rubular.com/r/EMk5MpiUzt
Rule.new(/(?<=\d)\.(?=\S)/, '∯')
- NewLineNumberPeriodSpaceLetterRule =
Rubular: rubular.com/r/rf4l1HjtjG
Rule.new(/(?<=\r\d)\.(?=(\s\S)|\))/, '∯')
- StartLineNumberPeriodRule =
Rubular: rubular.com/r/HPa4sdc6b9
Rule.new(/(?<=^\d)\.(?=(\s\S)|\))/, '∯')
- StartLineTwoDigitNumberPeriodRule =
Rubular: rubular.com/r/NuvWnKleFl
Rule.new(/(?<=^\d\d)\.(?=(\s\S)|\))/, '∯')
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text:) ⇒ Number
constructor
A new instance of Number.
- #replace ⇒ Object
Constructor Details
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
22 23 24 |
# File 'lib/pragmatic_segmenter/number.rb', line 22 def text @text end |
Instance Method Details
#replace ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/pragmatic_segmenter/number.rb', line 27 def replace @text.apply PeriodBeforeNumberRule, NumberAfterPeriodBeforeLetterRule, NewLineNumberPeriodSpaceLetterRule, StartLineNumberPeriodRule, StartLineTwoDigitNumberPeriodRule end |