Skip to content

Instantly share code, notes, and snippets.

@ravelll
Created April 14, 2018 09:53
Show Gist options
  • Save ravelll/4d831a22d8c97873d3f6d191d1635bce to your computer and use it in GitHub Desktop.
Save ravelll/4d831a22d8c97873d3f6d191d1635bce to your computer and use it in GitHub Desktop.
def answer?(str)
filtered = str.split('').keep_if{|s| s.match(/[a-zA-Z0-9-]/)}
if filtered && filtered.count == filtered.uniq.count
return true
end
false
end
pp IO.readlines("./english_collocates.md", chomp: true).keep_if{|s| answer?(s)}.sort_by{|s| s.length}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment