Class: Gcloud::Translate::Detection::Result
- Inherits:
-
Object
- Object
- Gcloud::Translate::Detection::Result
- Defined in:
- lib/gcloud/translate/detection.rb
Overview
# Result
Represents an individual result in a Gcloud::Translate::Detection result.
Instance Attribute Summary collapse
-
#confidence ⇒ Float
readonly
The confidence that the language detection result is correct.
-
#language ⇒ String
readonly
The language detected.
Class Method Summary collapse
-
.from_gapi(gapi) ⇒ Object
defined by the Google API Client object.
Instance Method Summary collapse
-
#initialize(confidence, language) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(confidence, language) ⇒ Result
Returns a new instance of Result.
123 124 125 126 |
# File 'lib/gcloud/translate/detection.rb', line 123 def initialize confidence, language @confidence = confidence @language = language end |
Instance Attribute Details
#confidence ⇒ Float (readonly)
The confidence that the language detection result is correct. The closer this value is to 1, the higher the confidence in language detection.
111 112 113 |
# File 'lib/gcloud/translate/detection.rb', line 111 def confidence @confidence end |
#language ⇒ String (readonly)
The language detected. This is an [ISO 639-1](en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code.
119 120 121 |
# File 'lib/gcloud/translate/detection.rb', line 119 def language @language end |
Class Method Details
.from_gapi(gapi) ⇒ Object
defined by the Google API Client object.
131 132 133 |
# File 'lib/gcloud/translate/detection.rb', line 131 def self.from_gapi gapi new gapi["confidence"], gapi["language"] end |