Skip to content

Instantly share code, notes, and snippets.

@chrislo
Last active August 29, 2015 14:05
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 chrislo/8c8b812901a68c0bde06 to your computer and use it in GitHub Desktop.
Save chrislo/8c8b812901a68c0bde06 to your computer and use it in GitHub Desktop.
FuzzyMatch a list of strings
require 'fuzzy_match'
haystack = [
"Good brain, bad brain: Parkinson's disease",
"Archaeology of Portus: exploring the lost harbour of ancient Rome",
"The secret power of brands",
"The secret power of brands"
]
matcher = FuzzyMatch.new(haystack)
matcher.find('GBBB Parkinsons pre-course survey') # => "Good brain, bad brain: Parkinson's disease"
matcher.find('Southampton Portus pre-course') # => "Archaeology of Portus: exploring the lost harbour of ancient Rome"
matcher.find('The secret power of brands: pre-course survey') # => "The secret power of brands"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment