Sha256: eb29cb6ba1f39440c5673f3d9dc6046fe67e9c497afefed88dfb44290aa7b4cc
Contents?: true
Size: 380 Bytes
Versions: 4
Compression:
Stored size: 380 Bytes
Contents
module Soulmate module Helpers def prefixes_for_phrase(phrase) words = normalize(phrase).split(' ').reject do |w| Soulmate.stop_words.include?(w) end words.map do |w| (MIN_COMPLETE-1..(w.length-1)).map{ |l| w[0..l] } end.flatten.uniq end def normalize(str) str.downcase.gsub(/[^a-z0-9 ]/i, '').strip end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
soulmate-0.1.3 | lib/soulmate/helpers.rb |
soulmate-0.1.2 | lib/soulmate/helpers.rb |
soulmate-0.1.1 | lib/soulmate/helpers.rb |
soulmate-0.1.0 | lib/soulmate/helpers.rb |