Sha256: 73e52f1f5956c1e186e50d7263b5bf88c7605de03667951188033fc616373077

Contents?: true

Size: 710 Bytes

Versions: 111

Compression:

Stored size: 710 Bytes

Contents

require 'rbbt/ner/finder'

module EntityRESTHelpers
  def finder_find(term)
    return [] unless settings.respond_to? :finder and not settings.finder.nil? and not settings.finder.instances.empty?
    results = settings.finder.find(term)

    results.uniq.collect{|r| 
      info = r.info
      format_string = [info[:namespace], info[:format]].compact * ":"

      info[:code] = r

      if not format_string.empty?
        info[:value] = r + " [#{format_string}]" 
      else
        info[:value] = r
      end

      score = info.delete :score

      if Array === score
        info[:score] = score[0]
        info[:best] = score[1]
      end

      info 
    }.sort_by{|i| i[:score] || 0}.reverse
  end
end

Version data entries

111 entries across 111 versions & 1 rubygems

Version Path
rbbt-rest-1.6.19 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.18 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.17 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.16 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.15 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.14 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.13 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.12 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.11 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.10 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.9 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.8 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.7 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.6 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.5 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.4 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.3 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.2 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.1 lib/rbbt/rest/entity/finder.rb
rbbt-rest-1.6.0 lib/rbbt/rest/entity/finder.rb