I am wondering why these two lines of code at the bottom, which seem to
say the same thing, produce different results.
text is simply a long string.
words = text.scan(/\w+/)
stop_words = %w{the a by on for of are with just but and to the my I has
some in}
key_words = text.split{/\w…/}.select{|word| !stop_words.include?(word)}
This line of code results in a higher percentrage of key words to stop
words 76.58%
key_words_to_stop_words = ((key_words.length.to_f /
text.split{/\w…/}.count.to_f) * 100)
This line has been rendered as a comment, but produces 75.13% when run