Module: Indexable

Included in:
SystemService
Defined in:
lib/yasysdui/index.rb

Overview

works fine for small amounts of data

Instance Method Summary collapse

Instance Method Details

#each_wordObject



8
9
10
11
12
# File 'lib/yasysdui/index.rb', line 8

def each_word
  each_sentence{|sen|
    sen.split(%r{[[:space:]]+|[[:punct:]]+}).each{|w| yield w }
  }
end

#each_wordstartObject



14
15
16
17
18
19
20
21
22
# File 'lib/yasysdui/index.rb', line 14

def each_wordstart
  each_word{|w| 
    wstart = ''
    w.downcase.each_char{|c|
      wstart << c
      yield wstart 
    }
  }  
end