#!/usr/bin/env ruby
data = File.expand_path('../../data', __FILE__)
lib = File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'markov_chain'
require 'nokogiri'

mark = MarkovChain.new
doc = Nokogiri::XML(File.open("#{data}/macbeth.xml"))
doc.xpath('//LINE').map(&:text).each do |line|
  line = line.downcase
  mark.learn(line)
end
puts mark.talk

#!/usr/bin/env ruby
root = File.expand_path('../..', __FILE__)
data = "#{root}/data"
lib = "#{root}/lib"
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'markov_chain'
require 'playdoc_parser'
require 'tools'

mark = MarkovChain.new
if ARGV.empty?
  PlaydocParser.parse(File.open("#{data}/macbeth.xml"),
                      engine: mark)
else
  ARGV.each do |speaker|
    PlaydocParser.parse(File.open("#{data}/macbeth.xml"),
                        engine: mark,
                        speaker: speaker)
  end
end
puts sentence_case(mark.talk)

Update example app to use PlaydocParser
Update example app to use PlaydocParser
