Sha256: 71347619686d99d3c4b614f55c9e4b9fa2a697bc7a5993c1e7f34da7987640aa
Contents?: true
Size: 787 Bytes
Versions: 2
Compression:
Stored size: 787 Bytes
Contents
module Burghers class Response attr_reader :topics, :tags, :entities, :raw def initialize(json) @raw = json @topics = [] @tags = [] @entities = [] @relations = [] if @raw['doc']['meta']['language'] == "InputTextTooShort" raise DocumentTooSmallError, "Document too short to process." end @raw.each do |key, value| case value["_typeGroup"] when 'topics' @topics << { name: value['categoryName'], score: value['score'].to_f } when 'socialTag' @tags << { name: value['name'], :score => value['importance'].to_f } when 'entities' @entities << value when 'relations' @relations << value end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
burghers-0.0.4 | lib/burghers/response.rb |
burghers-0.0.3 | lib/burghers/response.rb |