@@ -165,7 +165,7 @@ def highest_relative_content(max_chunks = 10)
165165 avg_density = { }
166166 @items . each_key { |x | avg_density [ x ] = proximity_array_for_content ( x ) . inject ( 0.0 ) { |i , j | i + j [ 1 ] } }
167167
168- avg_density . keys . sort_by { |x | avg_density [ x ] } . reverse [ 0 ..max_chunks - 1 ] . map
168+ avg_density . keys . sort_by { |x | avg_density [ x ] } . reverse [ 0 ..( max_chunks - 1 ) ] . map
169169 end
170170
171171 # This function is the primitive that find_related and classify
@@ -180,10 +180,10 @@ def highest_relative_content(max_chunks = 10)
180180 # The parameter doc is the content to compare. If that content is not
181181 # indexed, you can pass an optional block to define how to create the
182182 # text data. See add_item for examples of how this works.
183- def proximity_array_for_content ( doc , &block )
183+ def proximity_array_for_content ( doc , &)
184184 return [ ] if needs_rebuild?
185185
186- content_node = node_for_content ( doc , &block )
186+ content_node = node_for_content ( doc , &)
187187 result =
188188 @items . keys . collect do |item |
189189 val = if self . class . gsl_available
@@ -201,10 +201,10 @@ def proximity_array_for_content(doc, &block)
201201 # calculated vectors instead of their full versions. This is useful when
202202 # you're trying to perform operations on content that is much smaller than
203203 # the text you're working with. search uses this primitive.
204- def proximity_norms_for_content ( doc , &block )
204+ def proximity_norms_for_content ( doc , &)
205205 return [ ] if needs_rebuild?
206206
207- content_node = node_for_content ( doc , &block )
207+ content_node = node_for_content ( doc , &)
208208 result =
209209 @items . keys . collect do |item |
210210 val = if self . class . gsl_available
@@ -229,7 +229,7 @@ def search(string, max_nearest = 3)
229229
230230 carry = proximity_norms_for_content ( string )
231231 result = carry . collect { |x | x [ 0 ] }
232- result [ 0 ..max_nearest - 1 ]
232+ result [ 0 ..( max_nearest - 1 ) ]
233233 end
234234
235235 # This function takes content and finds other documents
@@ -245,7 +245,7 @@ def find_related(doc, max_nearest = 3, &block)
245245 carry =
246246 proximity_array_for_content ( doc , &block ) . reject { |pair | pair [ 0 ] == doc }
247247 result = carry . collect { |x | x [ 0 ] }
248- result [ 0 ..max_nearest - 1 ]
248+ result [ 0 ..( max_nearest - 1 ) ]
249249 end
250250
251251 # This function uses a voting system to categorize documents, based on
@@ -257,17 +257,17 @@ def find_related(doc, max_nearest = 3, &block)
257257 # text. A cutoff of 1 means that every document in the index votes on
258258 # what category the document is in. This may not always make sense.
259259 #
260- def classify ( doc , cutoff = 0.30 , &block )
261- votes = vote ( doc , cutoff , &block )
260+ def classify ( doc , cutoff = 0.30 , &)
261+ votes = vote ( doc , cutoff , &)
262262
263263 ranking = votes . keys . sort_by { |x | votes [ x ] }
264264 ranking [ -1 ]
265265 end
266266
267- def vote ( doc , cutoff = 0.30 , &block )
267+ def vote ( doc , cutoff = 0.30 , &)
268268 icutoff = ( @items . size * cutoff ) . round
269- carry = proximity_array_for_content ( doc , &block )
270- carry = carry [ 0 ..icutoff - 1 ]
269+ carry = proximity_array_for_content ( doc , &)
270+ carry = carry [ 0 ..( icutoff - 1 ) ]
271271 votes = { }
272272 carry . each do |pair |
273273 categories = @items [ pair [ 0 ] ] . categories
@@ -291,8 +291,8 @@ def vote(doc, cutoff = 0.30, &block)
291291 #
292292 #
293293 # See classify() for argument docs
294- def classify_with_confidence ( doc , cutoff = 0.30 , &block )
295- votes = vote ( doc , cutoff , &block )
294+ def classify_with_confidence ( doc , cutoff = 0.30 , &)
295+ votes = vote ( doc , cutoff , &)
296296 votes_sum = votes . values . inject ( 0.0 ) { |sum , v | sum + v }
297297 return [ nil , nil ] if votes_sum . zero?
298298
@@ -309,7 +309,7 @@ def highest_ranked_stems(doc, count = 3)
309309 raise 'Requested stem ranking on non-indexed content!' unless @items [ doc ]
310310
311311 arr = node_for_content ( doc ) . lsi_vector . to_a
312- top_n = arr . sort . reverse [ 0 ..count - 1 ]
312+ top_n = arr . sort . reverse [ 0 ..( count - 1 ) ]
313313 top_n . collect { |x | @word_list . word_for_index ( arr . index ( x ) ) }
314314 end
315315
0 commit comments