lib/ruffini.rb
##
# Parses a given +string+ and adds its words to the markov dictionary.
Parses a given +string+ and adds its words to the markov dictionary.
Parses a given + string + and adds its words to the markov dictionary .
def parse!(string)
          words = string.split.map(&:downcase)
          for index in 0 .. (words.length - (@DEPTH + 1))
              if @store[ words[index..index+(@DEPTH - 1)] ].nil?
                  @store[ words[index..index+(@DEPTH - 1)] ] = [words[index+@DEPTH]]
              else
                  @store[ words[index..index+(@DEPTH - 1)] ].push words[index+@DEPTH]
              end
          end
          return @store
      end
def parse! ( string ) words = string . split . map ( & :downcase ) for index in 0 .. ( words . length - ( @DEPTH + 1 ) ) if @store [ words [ index .. index + ( @DEPTH - 1 ) ] ] . nil? @store [ words [ index .. index + ( @DEPTH - 1 ) ] ] = [ words [ index + @DEPTH ] ] else @store [ words [ index .. index + ( @DEPTH - 1 ) ] ] . push words [ index + @DEPTH ] end end return @store end
Parses a given +string+ and adds its words to the markov dictionary.
Parses a given + string + and adds its words to the markov dictionary .
string
<not_specific>