Module: Yandex::Translator::Detect

Included in:
Yandex::Translator
Defined in:
lib/yandex/translator/detect.rb

Overview

Detection module

Instance Method Summary collapse

Instance Method Details

#detect(args = {}) ⇒ Object

Detect language



6
7
8
9
10
11
12
# File 'lib/yandex/translator/detect.rb', line 6

def detect(args = {})
  check_args(text: args[:text])
  response = request('/detect', hint: args[:hint], text: args[:text])
  response.parsed_response
rescue YandexFailure => ex
  return { error: ex.message }
end