Sha256: 66fdaf3311119b75e0a958df5145e9a2839cfb3c1d67248ce0258adf110249ff
Contents?: true
Size: 840 Bytes
Versions: 1
Compression:
Stored size: 840 Bytes
Contents
class NameSpotter class NetiNetiClient < Client def initialize(opts = { host: '0.0.0.0', port: 6384 }) super end def find(text) # the form does not get sent if text is nil or empty return [] if text.nil? || text.empty? resource = RestClient::Resource.new("http://#{@host}:#{@port}", timeout: 9_000_000, open_timeout: 9_000_000, connection: "Keep-Alive") response = resource.post(data: text) response.body.split("|").collect do |info| res = info.split(",") name = res[0...-2].join(",") offset_start = res[-2] name.force_encoding('utf-8') normalized_name = NameSpotter::ScientificName.normalize(name) NameSpotter::ScientificName.new(name, :scientific_name => normalized_name, :start_position => offset_start.to_i) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
name-spotter-0.1.7 | lib/name-spotter/neti_neti_client.rb |