Last active
August 29, 2015 14:05
-
-
Save chrislo/8c8b812901a68c0bde06 to your computer and use it in GitHub Desktop.
FuzzyMatch a list of strings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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