Permalink
Browse files

Don't bother collecting more phrases once we have enough

  • Loading branch information...
1 parent 8be9301 commit b224160440729a5fc64da5c4c6d592d6ad98fb96 @kerryb committed Jul 15, 2009
Showing with 1 addition and 0 deletions.
  1. +1 −0 1.rb
View
@@ -9,6 +9,7 @@ def phrases(number)
words = split
all_strings = words
(2..words.size).each do |number_of_words|
+ break if all_strings.length >= number
all_strings += extract_phrases(words, number_of_words)
end
all_strings[0, number].map {|s| "'#{s}'"}.join(', ')

0 comments on commit b224160

Please sign in to comment.