Sha256: d0d73e2a994a92e4098b63d991ae26cdb84ac1fe4c67c384649a2d160f21fabc
Contents?: true
Size: 812 Bytes
Versions: 2
Compression:
Stored size: 812 Bytes
Contents
require "detect_language/version" require "detect_language/exception" require "detect_language/configuration" require "detect_language/client" module DetectLanguage class << self attr_writer :configuration def configure yield(configuration) end # The configuration object. # @see DetectLanguage.configure def configuration @configuration ||= Configuration.new end def client @client ||= Client.new(configuration) end def detect(data) key = data.is_a?(Array) ? 'q[]' : 'q' result = client.execute(:detect, key => data) result['data']['detections'] end def simple_detect(text) detections = detect(text) if detections.empty? nil else detections[0]['language'] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
detect_language-1.0.3 | lib/detect_language.rb |
detect_language-1.0.2 | lib/detect_language.rb |