Method: #bag_of_words
- Defined in:
- lib/zipf/stringutil.rb
#bag_of_words(s, stopwords = []) ⇒ Object
15 16 17 |
# File 'lib/zipf/stringutil.rb', line 15 def bag_of_words s, stopwords=[] s.strip.split.uniq.sort.reject{ |w| stopwords.include? w } end |