Use scan and better enumerator in phrase.rb