Class: Markovian::Utils::TextSplitter

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#textObject (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

#componentsObject



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