Class: Google::Cloud::Translate::Translation
- Inherits:
-
Object
- Object
- Google::Cloud::Translate::Translation
- Defined in:
- lib/google/cloud/translate/translation.rb
Overview
Translation
Represents a translation query result. Returned by Api#translate.
Instance Attribute Summary collapse
-
#from ⇒ String
(also: #source)
readonly
The source language from which the text was translated.
-
#model ⇒ String
readonly
The model used by the service to perform the translation.
-
#origin ⇒ String
readonly
The original query text that was translated.
-
#text ⇒ String
(also: #to_s, #to_str)
readonly
The translated result.
-
#to ⇒ String
(also: #language, #target)
readonly
The target language into which the text was translated.
Instance Method Summary collapse
-
#detected? ⇒ Boolean
Determines if the source language was detected by the Google Cloud Translate API.
Instance Attribute Details
#from ⇒ String (readonly) Also known as: source
The source language from which the text was translated.
69 70 71 |
# File 'lib/google/cloud/translate/translation.rb', line 69 def from @from end |
#model ⇒ String (readonly)
The model used by the service to perform the translation. When this is
set to nmt
, the translation was performed using premium neural
machine translation model. If it is not set or model is set to base
,
then the translation was done using standard model. In almost all
cases, the model type in response should match the model type
requested. However, in some limited situations this might not be the
case. In these cases, the request had nmt
parameter, but the
response has base
set or model is not returned. This happens when
neural translation did not give a satisfactory translation and we
completed the translation using the standard model. If this happens,
you will charged at the standard edition rate and not at the premium
rate.
87 88 89 |
# File 'lib/google/cloud/translate/translation.rb', line 87 def model @model end |
#origin ⇒ String (readonly)
The original query text that was translated.
55 56 57 |
# File 'lib/google/cloud/translate/translation.rb', line 55 def origin @origin end |
#text ⇒ String (readonly) Also known as: to_s, to_str
The translated result.
47 48 49 |
# File 'lib/google/cloud/translate/translation.rb', line 47 def text @text end |
#to ⇒ String (readonly) Also known as: language, target
The target language into which the text was translated.
61 62 63 |
# File 'lib/google/cloud/translate/translation.rb', line 61 def to @to end |
Instance Method Details
#detected? ⇒ Boolean
Determines if the source language was detected by the Google Cloud Translate API.
107 108 109 |
# File 'lib/google/cloud/translate/translation.rb', line 107 def detected? @detected end |