lib/megahal/megahal.rb
def train(filename, bar = nil)
    lines = File.read(filename).each_line.to_a
    bar.total = lines.length unless bar.nil?
    _train(lines, bar)
  end
# Train MegaHAL with the contents of the specified file, which should be plain
# text with one sentence per line.  Note that it takes MegaHAL about one
# second to process about 500 lines, so large files may cause the process to
# block for a while. Lines that are too long will be skipped.
#
# @param [String] filename The text file to be used for training.
# @param [ProgressBar] bar An optional progress bar instance.
Train MegaHAL with the contents of the specified file, which should be plain
text with one sentence per line.  Note that it takes MegaHAL about one
second to process about 500 lines, so large files may cause the process to
block for a while. Lines that are too long will be skipped.
Train MegaHAL with the contents of the specified file which should be plain text with one sentence per line . Note that it takes MegaHAL about one second to process about 500 lines so large files may cause the process to block for a while . Lines that are too long will be skipped .
def train(filename, bar = nil)
    lines = File.read(filename).each_line.to_a
    bar.total = lines.length unless bar.nil?
    _train(lines, bar)
  end
def train ( filename , bar = nil ) lines = File . read ( filename ) . each_line . to_a bar . total = lines . length unless bar . nil? _train ( lines , bar ) end
Train MegaHAL with the contents of the specified file, which should be plain
text with one sentence per line.
Train MegaHAL with the contents of the specified file which should be plain text with one sentence per line .
filename
bar
bar An optional progress bar instance.
bar An optional progress bar instance .