Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/linguo/core_ext/string.rb
Instance Method Summary collapse
-
#lang ⇒ Array
Retrieves all the languages detected for the current string sorted by confidence.
Instance Method Details
#lang ⇒ Array
Retrieves all the languages detected for the current string sorted by confidence.
Requires Linguo::Config.api_key
or ENV['LINGUO_API_KEY']
to be set up.
11 12 13 14 15 16 |
# File 'lib/linguo/core_ext/string.rb', line 11 def lang l ||= Linguo.detect(self, Linguo::Config.api_key) l.detections.map {|x| x['language']} rescue => e raise Linguo::Errors::LinguoError, e. end |