def most_similar(value, threshold = 0.5)
      @white ||= Text::WhiteSimilarity.new
      result = @map.max_by { |str, _| @white.similarity(value, str) }

      return result[1] if @white.similarity(value, result.first) > threshold
      nil
    end
def most_similar(value, threshold = 0.5)
      @white ||= Text::WhiteSimilarity.new
      result = @map.max_by { |str, _| @white.similarity(value, str) }

      return result[1] if @white.similarity(value, result.first) > threshold
      nil
    end
Performs White Similarity comparison against the keys, and gives the
 value of the closest match.

 @param value [String] a string value to compare to the hash map keys.
 @param threshold [Float] the value at which a string is considered to
   be a match

 @return [RDF::Vocabulary::Term, nil] the closest DCMI type match, or `nil`
   if none is sufficiently close

 @see Text::WhiteSimilarity
 @see http://www.catalysoft.com/articles/strikeamatch.html article defining
   the White Similarity algorithm

 @todo consider text similarity algorithms/strategies and move text
   matching to a utility and behind a Facade interface.