class Gamefic::Scanner::Fuzzy

Fuzzy token matching.

An entity will match a word in a fuzzy scan if it matches the beginning of one of the entity’s keywords, e.g., ‘pen` is a fuzzy token match for the keyword `pencil`.

Public Instance Methods

match_word(available, word) click to toggle source
# File lib/gamefic/scanner/fuzzy.rb, line 12
def match_word available, word
  available.select { |obj| obj.keywords.any? { |wrd| wrd.start_with?(word) } }
end