I\'m currently doing an exercism.io for Ruby and can\'t pass the last test. The last test reads :
def test_with_apostrophes phrase = Phrase.new(\"First: don\'
Try this for getting your frequency of words,
words_freq = Hash.new(0) "First: don't laugh. Then: don't cry.".split(/\s+/).each { |word| words_freq[word.downcase.delete(':|.')] += 1 }
gives #words_freq = {"first"=>1, "don't"=>2, "laugh"=>1, "then"=>1, "cry"=>1}
#words_freq = {"first"=>1, "don't"=>2, "laugh"=>1, "then"=>1, "cry"=>1}