sentence count
lines = File.readlines("text.txt") line_count = lines.size text = lines.join puts "#{line_count} lines" sentence_count = text.split(/\.|\?|!/).length puts "#{sentence_count} sentences"