Skip to content

Instantly share code, notes, and snippets.

@fskinner
Created February 6, 2012 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fskinner/1754193 to your computer and use it in GitHub Desktop.
Save fskinner/1754193 to your computer and use it in GitHub Desktop.
Identificar nomes
def identify_name text
words = text.split(' ')
words_number = words.count
[].tap do |result|
for i in 1..words.count
words.permutation(i).to_a.each do |word|
result << word if i == 1 || words.first == word.first
end
end
end
result.uniq
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment