Sha256: 26cf314c5f89765962778446c9370f5f35af0104d6119acaabb9dc5a6b7ee26c
Contents?: true
Size: 323 Bytes
Versions: 37
Compression:
Stored size: 323 Bytes
Contents
module SuggestTag def suggest_tags tags = [] threshold = (self.strip.split(//).size * 0.2).round Bookmark.tag_counts(:limit => 100).each do |t| distance = Text::Levenshtein.distance(t.name, self) tags << t if distance <= threshold end tags end end class String include SuggestTag end
Version data entries
37 entries across 37 versions & 1 rubygems