Class: Markovian::Utils::TextSplitter
- Inherits:
-
Object
- Object
- Markovian::Utils::TextSplitter
- Defined in:
- lib/markovian/utils/text_splitter.rb
Constant Summary collapse
- MARKERS_OF_INTEREST =
anything that doesn’t contain any letters is not a word we need to care about
/[A-Za-z]/
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #components ⇒ Object
-
#initialize(text) ⇒ TextSplitter
constructor
A new instance of TextSplitter.
Constructor Details
#initialize(text) ⇒ TextSplitter
Returns a new instance of TextSplitter.
7 8 9 |
# File 'lib/markovian/utils/text_splitter.rb', line 7 def initialize(text) @text = text end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
6 7 8 |
# File 'lib/markovian/utils/text_splitter.rb', line 6 def text @text end |
Instance Method Details
#components ⇒ Object
14 15 16 |
# File 'lib/markovian/utils/text_splitter.rb', line 14 def components split_text.select {|w| w.text.match(MARKERS_OF_INTEREST)} end |