Module: Linguin
- Defined in:
- lib/linguin.rb,
lib/linguin/client.rb,
lib/linguin/status.rb,
lib/linguin/version.rb,
lib/linguin/languages.rb,
lib/linguin/exceptions.rb,
lib/linguin/base_response.rb,
lib/linguin/language_detection.rb,
lib/linguin/profanity_detection.rb,
lib/linguin/bulk_language_detection.rb,
lib/linguin/bulk_profanity_detection.rb
Overview
Linguin API wrapper module
Can be used as a singleton to access all API methods. Alternatively, Linguin::Client can be instantiated.
Linguin.detect
- :
text
: -
The text to be used for language detection.
Attempts to detect the language of the given text. Returns a Linguin::Response object.
Linguin.detect!
- :
text
: -
The text to be used for language detection.
Just like #detect but raises an exception if anything goes wrong.
Linguin.status
Returns the status of your Linguin account as Linguin::Status
-
number of requests today
-
daily detection limit of your account (false for unlimited)
-
remaining detections today (can be Infinity)
Linguin.languages
Returns the list of supported languages.
Defined Under Namespace
Classes: AuthenticationError, BaseResponse, BulkLanguageDetection, BulkProfanityDetection, Client, Error, InputError, InternalError, LanguageDetection, Languages, NotFoundError, ProfanityDetection, RateLimitError, Status
Constant Summary collapse
- VERSION =
"2.0.0"
Class Method Summary collapse
- .api_key=(api_key) ⇒ Object
- .detect_language(text) ⇒ Object
- .detect_language!(text) ⇒ Object
- .detect_profanity(text) ⇒ Object
- .detect_profanity!(text) ⇒ Object
- .languages ⇒ Object
- .status ⇒ Object
Class Method Details
.api_key=(api_key) ⇒ Object
37 38 39 |
# File 'lib/linguin.rb', line 37 def api_key=(api_key) default_client.api_key = api_key end |
.detect_language(text) ⇒ Object
41 42 43 |
# File 'lib/linguin.rb', line 41 def detect_language(text) default_client.detect_language(text) end |
.detect_language!(text) ⇒ Object
45 46 47 |
# File 'lib/linguin.rb', line 45 def detect_language!(text) default_client.detect_language!(text) end |
.detect_profanity(text) ⇒ Object
49 50 51 |
# File 'lib/linguin.rb', line 49 def detect_profanity(text) default_client.detect_profanity(text) end |
.detect_profanity!(text) ⇒ Object
53 54 55 |
# File 'lib/linguin.rb', line 53 def detect_profanity!(text) default_client.detect_profanity!(text) end |
.languages ⇒ Object
61 62 63 |
# File 'lib/linguin.rb', line 61 def languages default_client.languages end |
.status ⇒ Object
57 58 59 |
# File 'lib/linguin.rb', line 57 def status default_client.status end |