Method: TranslatorText::Client#detect
- Defined in:
- lib/translator_text/client.rb
#detect(sentences) ⇒ Array<TranslatorText::Types::DetectionResult>
Identifies the language of a piece of text.
The following limitations apply:
-
The array sentences can have at most 100 elements.
-
The text value of an array element cannot exceed 10,000 characters including spaces.
-
The entire text included in the request cannot exceed 50,000 characters including spaces.
62 63 64 65 66 67 68 69 |
# File 'lib/translator_text/client.rb', line 62 def detect(sentences) results = post( '/detect', body: build_sentences(sentences).to_json ) results.map { |r| Types::DetectionResult.new(r) } end |