google-cloud-translate-v3 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google/cloud/translate/v3/translation_service/client.rb +296 -11
- data/lib/google/cloud/translate/v3/translation_service_pb.rb +99 -0
- data/lib/google/cloud/translate/v3/translation_service_services_pb.rb +11 -2
- data/lib/google/cloud/translate/v3/version.rb +1 -1
- data/proto_docs/google/cloud/translate/v3/translation_service.rb +559 -25
- metadata +2 -2
@@ -1,7 +1,7 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# Source: google/cloud/translate/v3/translation_service.proto for package 'Google.Cloud.Translate.V3'
|
3
3
|
# Original file comments:
|
4
|
-
# Copyright
|
4
|
+
# Copyright 2021 Google LLC
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
@@ -15,7 +15,6 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
#
|
19
18
|
|
20
19
|
require 'grpc'
|
21
20
|
require 'google/cloud/translate/v3/translation_service_pb'
|
@@ -42,6 +41,8 @@ module Google
|
|
42
41
|
rpc :DetectLanguage, ::Google::Cloud::Translate::V3::DetectLanguageRequest, ::Google::Cloud::Translate::V3::DetectLanguageResponse
|
43
42
|
# Returns a list of supported languages for translation.
|
44
43
|
rpc :GetSupportedLanguages, ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest, ::Google::Cloud::Translate::V3::SupportedLanguages
|
44
|
+
# Translates documents in synchronous mode.
|
45
|
+
rpc :TranslateDocument, ::Google::Cloud::Translate::V3::TranslateDocumentRequest, ::Google::Cloud::Translate::V3::TranslateDocumentResponse
|
45
46
|
# Translates a large volume of text in asynchronous batch mode.
|
46
47
|
# This function provides real-time output as the inputs are being processed.
|
47
48
|
# If caller cancels a request, the partial results (for an input file, it's
|
@@ -50,6 +51,14 @@ module Google
|
|
50
51
|
# This call returns immediately and you can
|
51
52
|
# use google.longrunning.Operation.name to poll the status of the call.
|
52
53
|
rpc :BatchTranslateText, ::Google::Cloud::Translate::V3::BatchTranslateTextRequest, ::Google::Longrunning::Operation
|
54
|
+
# Translates a large volume of document in asynchronous batch mode.
|
55
|
+
# This function provides real-time output as the inputs are being processed.
|
56
|
+
# If caller cancels a request, the partial results (for an input file, it's
|
57
|
+
# all or nothing) may still be available on the specified output location.
|
58
|
+
#
|
59
|
+
# This call returns immediately and you can use
|
60
|
+
# google.longrunning.Operation.name to poll the status of the call.
|
61
|
+
rpc :BatchTranslateDocument, ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest, ::Google::Longrunning::Operation
|
53
62
|
# Creates a glossary and returns the long-running operation. Returns
|
54
63
|
# NOT_FOUND, if the project doesn't exist.
|
55
64
|
rpc :CreateGlossary, ::Google::Cloud::Translate::V3::CreateGlossaryRequest, ::Google::Longrunning::Operation
|
@@ -25,8 +25,12 @@ module Google
|
|
25
25
|
# and defines options for applying that glossary.
|
26
26
|
# @!attribute [rw] glossary
|
27
27
|
# @return [::String]
|
28
|
-
# Required.
|
29
|
-
#
|
28
|
+
# Required. The `glossary` to be applied for this translation.
|
29
|
+
#
|
30
|
+
# The format depends on glossary:
|
31
|
+
#
|
32
|
+
# - User provided custom glossary:
|
33
|
+
# `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`
|
30
34
|
# @!attribute [rw] ignore_case
|
31
35
|
# @return [::Boolean]
|
32
36
|
# Optional. Indicates match is case-insensitive.
|
@@ -40,7 +44,8 @@ module Google
|
|
40
44
|
# @!attribute [rw] contents
|
41
45
|
# @return [::Array<::String>]
|
42
46
|
# Required. The content of the input in string format.
|
43
|
-
# We recommend the total content be less than 30k codepoints.
|
47
|
+
# We recommend the total content be less than 30k codepoints. The max length
|
48
|
+
# of this field is 1024.
|
44
49
|
# Use BatchTranslateText for larger text.
|
45
50
|
# @!attribute [rw] mime_type
|
46
51
|
# @return [::String]
|
@@ -84,14 +89,13 @@ module Google
|
|
84
89
|
#
|
85
90
|
# - General (built-in) models:
|
86
91
|
# `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
|
87
|
-
# `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
|
88
92
|
#
|
89
93
|
#
|
90
94
|
# For global (non-regionalized) requests, use `location-id` `global`.
|
91
95
|
# For example,
|
92
96
|
# `projects/{project-number-or-id}/locations/global/models/general/nmt`.
|
93
97
|
#
|
94
|
-
# If
|
98
|
+
# If not provided, the default Google model (NMT) will be used.
|
95
99
|
# @!attribute [rw] glossary_config
|
96
100
|
# @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig]
|
97
101
|
# Optional. Glossary to be applied. The glossary must be
|
@@ -106,7 +110,8 @@ module Google
|
|
106
110
|
# characters, underscores and dashes. International characters are allowed.
|
107
111
|
# Label values are optional. Label keys must start with a letter.
|
108
112
|
#
|
109
|
-
# See https://cloud.google.com/translate/docs/labels for more
|
113
|
+
# See https://cloud.google.com/translate/docs/advanced/labels for more
|
114
|
+
# information.
|
110
115
|
class TranslateTextRequest
|
111
116
|
include ::Google::Protobuf::MessageExts
|
112
117
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -142,6 +147,8 @@ module Google
|
|
142
147
|
# @!attribute [rw] translated_text
|
143
148
|
# @return [::String]
|
144
149
|
# Text translated into the target language.
|
150
|
+
# If an error occurs during translation, this field might be excluded from
|
151
|
+
# the response.
|
145
152
|
# @!attribute [rw] model
|
146
153
|
# @return [::String]
|
147
154
|
# Only present when `model` is present in the request.
|
@@ -207,7 +214,8 @@ module Google
|
|
207
214
|
# characters, underscores and dashes. International characters are allowed.
|
208
215
|
# Label values are optional. Label keys must start with a letter.
|
209
216
|
#
|
210
|
-
# See https://cloud.google.com/translate/docs/labels for more
|
217
|
+
# See https://cloud.google.com/translate/docs/advanced/labels for more
|
218
|
+
# information.
|
211
219
|
class DetectLanguageRequest
|
212
220
|
include ::Google::Protobuf::MessageExts
|
213
221
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -238,8 +246,8 @@ module Google
|
|
238
246
|
# The response message for language detection.
|
239
247
|
# @!attribute [rw] languages
|
240
248
|
# @return [::Array<::Google::Cloud::Translate::V3::DetectedLanguage>]
|
241
|
-
#
|
242
|
-
#
|
249
|
+
# The most probable language detected by the Translation API. For each
|
250
|
+
# request, the Translation API will always return only one result.
|
243
251
|
class DetectLanguageResponse
|
244
252
|
include ::Google::Protobuf::MessageExts
|
245
253
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -277,11 +285,10 @@ module Google
|
|
277
285
|
#
|
278
286
|
# - General (built-in) models:
|
279
287
|
# `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
|
280
|
-
# `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
|
281
288
|
#
|
282
289
|
#
|
283
290
|
# Returns languages supported by the specified model.
|
284
|
-
# If missing, we get supported languages of Google general
|
291
|
+
# If missing, we get supported languages of Google general NMT model.
|
285
292
|
class GetSupportedLanguagesRequest
|
286
293
|
include ::Google::Protobuf::MessageExts
|
287
294
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -364,9 +371,11 @@ module Google
|
|
364
371
|
# The Google Cloud Storage location for the output content.
|
365
372
|
# @!attribute [rw] output_uri_prefix
|
366
373
|
# @return [::String]
|
367
|
-
# Required.
|
368
|
-
# 'output_uri_prefix' must end with
|
369
|
-
#
|
374
|
+
# Required. The bucket used in 'output_uri_prefix' must exist and there must
|
375
|
+
# be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with
|
376
|
+
# "/" and start with "gs://". One 'output_uri_prefix' can only be used by one
|
377
|
+
# batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error
|
378
|
+
# is returned.
|
370
379
|
class GcsDestination
|
371
380
|
include ::Google::Protobuf::MessageExts
|
372
381
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -407,8 +416,13 @@ module Google
|
|
407
416
|
# processed and ready to be consumed (that is, no partial output file is
|
408
417
|
# written).
|
409
418
|
#
|
419
|
+
# Since index.csv will be keeping updated during the process, please make
|
420
|
+
# sure there is no custom retention policy applied on the output bucket
|
421
|
+
# that may avoid file updating.
|
422
|
+
# (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy)
|
423
|
+
#
|
410
424
|
# The format of translations_file (for target language code 'trg') is:
|
411
|
-
#
|
425
|
+
# gs://translation_test/a_b_c_'trg'_translations.[extension]
|
412
426
|
#
|
413
427
|
# If the input file extension is tsv, the output has the following
|
414
428
|
# columns:
|
@@ -425,10 +439,10 @@ module Google
|
|
425
439
|
# If input file extension is a txt or html, the translation is directly
|
426
440
|
# written to the output file. If glossary is requested, a separate
|
427
441
|
# glossary_translations_file has format of
|
428
|
-
#
|
442
|
+
# gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
|
429
443
|
#
|
430
444
|
# The format of errors file (for target language code 'trg') is:
|
431
|
-
#
|
445
|
+
# gs://translation_test/a_b_c_'trg'_errors.[extension]
|
432
446
|
#
|
433
447
|
# If the input file extension is tsv, errors_file contains the following:
|
434
448
|
# Column 1: ID of the request provided in the input, if it's not
|
@@ -440,12 +454,229 @@ module Google
|
|
440
454
|
#
|
441
455
|
# If the input file extension is txt or html, glossary_error_file will be
|
442
456
|
# generated that contains error details. glossary_error_file has format of
|
443
|
-
#
|
457
|
+
# gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
|
444
458
|
class OutputConfig
|
445
459
|
include ::Google::Protobuf::MessageExts
|
446
460
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
447
461
|
end
|
448
462
|
|
463
|
+
# A document translation request input config.
|
464
|
+
# @!attribute [rw] content
|
465
|
+
# @return [::String]
|
466
|
+
# Document's content represented as a stream of bytes.
|
467
|
+
# @!attribute [rw] gcs_source
|
468
|
+
# @return [::Google::Cloud::Translate::V3::GcsSource]
|
469
|
+
# Google Cloud Storage location. This must be a single file.
|
470
|
+
# For example: gs://example_bucket/example_file.pdf
|
471
|
+
# @!attribute [rw] mime_type
|
472
|
+
# @return [::String]
|
473
|
+
# Specifies the input document's mime_type.
|
474
|
+
#
|
475
|
+
# If not specified it will be determined using the file extension for
|
476
|
+
# gcs_source provided files. For a file provided through bytes content the
|
477
|
+
# mime_type must be provided.
|
478
|
+
# Currently supported mime types are:
|
479
|
+
# - application/pdf
|
480
|
+
# - application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
481
|
+
# - application/vnd.openxmlformats-officedocument.presentationml.presentation
|
482
|
+
# - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
483
|
+
class DocumentInputConfig
|
484
|
+
include ::Google::Protobuf::MessageExts
|
485
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
486
|
+
end
|
487
|
+
|
488
|
+
# A document translation request output config.
|
489
|
+
# @!attribute [rw] gcs_destination
|
490
|
+
# @return [::Google::Cloud::Translate::V3::GcsDestination]
|
491
|
+
# Optional. Google Cloud Storage destination for the translation output,
|
492
|
+
# e.g., `gs://my_bucket/my_directory/`.
|
493
|
+
#
|
494
|
+
# The destination directory provided does not have to be empty, but the
|
495
|
+
# bucket must exist. If a file with the same name as the output file
|
496
|
+
# already exists in the destination an error will be returned.
|
497
|
+
#
|
498
|
+
# For a DocumentInputConfig.contents provided document, the output file
|
499
|
+
# will have the name "output_[trg]_translations.[ext]", where
|
500
|
+
# - [trg] corresponds to the translated file's language code,
|
501
|
+
# - [ext] corresponds to the translated file's extension according to its
|
502
|
+
# mime type.
|
503
|
+
#
|
504
|
+
#
|
505
|
+
# For a DocumentInputConfig.gcs_uri provided document, the output file will
|
506
|
+
# have a name according to its URI. For example: an input file with URI:
|
507
|
+
# "gs://a/b/c.[extension]" stored in a gcs_destination bucket with name
|
508
|
+
# "my_bucket" will have an output URI:
|
509
|
+
# "gs://my_bucket/a_b_c_[trg]_translations.[ext]", where
|
510
|
+
# - [trg] corresponds to the translated file's language code,
|
511
|
+
# - [ext] corresponds to the translated file's extension according to its
|
512
|
+
# mime type.
|
513
|
+
#
|
514
|
+
#
|
515
|
+
# If the document was directly provided through the request, then the
|
516
|
+
# output document will have the format:
|
517
|
+
# "gs://my_bucket/translated_document_[trg]_translations.[ext], where
|
518
|
+
# - [trg] corresponds to the translated file's language code,
|
519
|
+
# - [ext] corresponds to the translated file's extension according to its
|
520
|
+
# mime type.
|
521
|
+
#
|
522
|
+
# If a glossary was provided, then the output URI for the glossary
|
523
|
+
# translation will be equal to the default output URI but have
|
524
|
+
# `glossary_translations` instead of `translations`. For the previous
|
525
|
+
# example, its glossary URI would be:
|
526
|
+
# "gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]".
|
527
|
+
#
|
528
|
+
# Thus the max number of output files will be 2 (Translated document,
|
529
|
+
# Glossary translated document).
|
530
|
+
#
|
531
|
+
# Callers should expect no partial outputs. If there is any error during
|
532
|
+
# document translation, no output will be stored in the Cloud Storage
|
533
|
+
# bucket.
|
534
|
+
# @!attribute [rw] mime_type
|
535
|
+
# @return [::String]
|
536
|
+
# Optional. Specifies the translated document's mime_type.
|
537
|
+
# If not specified, the translated file's mime type will be the same as the
|
538
|
+
# input file's mime type.
|
539
|
+
# Currently only support the output mime type to be the same as input mime
|
540
|
+
# type.
|
541
|
+
# - application/pdf
|
542
|
+
# - application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
543
|
+
# - application/vnd.openxmlformats-officedocument.presentationml.presentation
|
544
|
+
# - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
545
|
+
class DocumentOutputConfig
|
546
|
+
include ::Google::Protobuf::MessageExts
|
547
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
548
|
+
end
|
549
|
+
|
550
|
+
# A document translation request.
|
551
|
+
# @!attribute [rw] parent
|
552
|
+
# @return [::String]
|
553
|
+
# Required. Location to make a regional call.
|
554
|
+
#
|
555
|
+
# Format: `projects/{project-number-or-id}/locations/{location-id}`.
|
556
|
+
#
|
557
|
+
# For global calls, use `projects/{project-number-or-id}/locations/global` or
|
558
|
+
# `projects/{project-number-or-id}`.
|
559
|
+
#
|
560
|
+
# Non-global location is required for requests using AutoML models or custom
|
561
|
+
# glossaries.
|
562
|
+
#
|
563
|
+
# Models and glossaries must be within the same region (have the same
|
564
|
+
# location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
|
565
|
+
# @!attribute [rw] source_language_code
|
566
|
+
# @return [::String]
|
567
|
+
# Optional. The BCP-47 language code of the input document if known, for
|
568
|
+
# example, "en-US" or "sr-Latn". Supported language codes are listed in
|
569
|
+
# Language Support. If the source language isn't specified, the API attempts
|
570
|
+
# to identify the source language automatically and returns the source
|
571
|
+
# language within the response. Source language must be specified if the
|
572
|
+
# request contains a glossary or a custom model.
|
573
|
+
# @!attribute [rw] target_language_code
|
574
|
+
# @return [::String]
|
575
|
+
# Required. The BCP-47 language code to use for translation of the input
|
576
|
+
# document, set to one of the language codes listed in Language Support.
|
577
|
+
# @!attribute [rw] document_input_config
|
578
|
+
# @return [::Google::Cloud::Translate::V3::DocumentInputConfig]
|
579
|
+
# Required. Input configurations.
|
580
|
+
# @!attribute [rw] document_output_config
|
581
|
+
# @return [::Google::Cloud::Translate::V3::DocumentOutputConfig]
|
582
|
+
# Optional. Output configurations.
|
583
|
+
# Defines if the output file should be stored within Cloud Storage as well
|
584
|
+
# as the desired output format. If not provided the translated file will
|
585
|
+
# only be returned through a byte-stream and its output mime type will be
|
586
|
+
# the same as the input file's mime type.
|
587
|
+
# @!attribute [rw] model
|
588
|
+
# @return [::String]
|
589
|
+
# Optional. The `model` type requested for this translation.
|
590
|
+
#
|
591
|
+
# The format depends on model type:
|
592
|
+
#
|
593
|
+
# - AutoML Translation models:
|
594
|
+
# `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
|
595
|
+
#
|
596
|
+
# - General (built-in) models:
|
597
|
+
# `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
|
598
|
+
#
|
599
|
+
#
|
600
|
+
# If not provided, the default Google model (NMT) will be used for
|
601
|
+
# translation.
|
602
|
+
# @!attribute [rw] glossary_config
|
603
|
+
# @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig]
|
604
|
+
# Optional. Glossary to be applied. The glossary must be within the same
|
605
|
+
# region (have the same location-id) as the model, otherwise an
|
606
|
+
# INVALID_ARGUMENT (400) error is returned.
|
607
|
+
# @!attribute [rw] labels
|
608
|
+
# @return [::Google::Protobuf::Map{::String => ::String}]
|
609
|
+
# Optional. The labels with user-defined metadata for the request.
|
610
|
+
#
|
611
|
+
# Label keys and values can be no longer than 63 characters (Unicode
|
612
|
+
# codepoints), can only contain lowercase letters, numeric characters,
|
613
|
+
# underscores and dashes. International characters are allowed. Label values
|
614
|
+
# are optional. Label keys must start with a letter.
|
615
|
+
#
|
616
|
+
# See https://cloud.google.com/translate/docs/advanced/labels for more
|
617
|
+
# information.
|
618
|
+
class TranslateDocumentRequest
|
619
|
+
include ::Google::Protobuf::MessageExts
|
620
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
621
|
+
|
622
|
+
# @!attribute [rw] key
|
623
|
+
# @return [::String]
|
624
|
+
# @!attribute [rw] value
|
625
|
+
# @return [::String]
|
626
|
+
class LabelsEntry
|
627
|
+
include ::Google::Protobuf::MessageExts
|
628
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
629
|
+
end
|
630
|
+
end
|
631
|
+
|
632
|
+
# A translated document message.
|
633
|
+
# @!attribute [rw] byte_stream_outputs
|
634
|
+
# @return [::Array<::String>]
|
635
|
+
# The array of translated documents. It is expected to be size 1 for now. We
|
636
|
+
# may produce multiple translated documents in the future for other type of
|
637
|
+
# file formats.
|
638
|
+
# @!attribute [rw] mime_type
|
639
|
+
# @return [::String]
|
640
|
+
# The translated document's mime type.
|
641
|
+
# @!attribute [rw] detected_language_code
|
642
|
+
# @return [::String]
|
643
|
+
# The detected language for the input document.
|
644
|
+
# If the user did not provide the source language for the input document,
|
645
|
+
# this field will have the language code automatically detected. If the
|
646
|
+
# source language was passed, auto-detection of the language does not occur
|
647
|
+
# and this field is empty.
|
648
|
+
class DocumentTranslation
|
649
|
+
include ::Google::Protobuf::MessageExts
|
650
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
651
|
+
end
|
652
|
+
|
653
|
+
# A translated document response message.
|
654
|
+
# @!attribute [rw] document_translation
|
655
|
+
# @return [::Google::Cloud::Translate::V3::DocumentTranslation]
|
656
|
+
# Translated document.
|
657
|
+
# @!attribute [rw] glossary_document_translation
|
658
|
+
# @return [::Google::Cloud::Translate::V3::DocumentTranslation]
|
659
|
+
# The document's translation output if a glossary is provided in the request.
|
660
|
+
# This can be the same as [TranslateDocumentResponse.document_translation]
|
661
|
+
# if no glossary terms apply.
|
662
|
+
# @!attribute [rw] model
|
663
|
+
# @return [::String]
|
664
|
+
# Only present when 'model' is present in the request.
|
665
|
+
# 'model' is normalized to have a project number.
|
666
|
+
#
|
667
|
+
# For example:
|
668
|
+
# If the 'model' field in TranslateDocumentRequest is:
|
669
|
+
# `projects/{project-id}/locations/{location-id}/models/general/nmt` then
|
670
|
+
# `model` here would be normalized to
|
671
|
+
# `projects/{project-number}/locations/{location-id}/models/general/nmt`.
|
672
|
+
# @!attribute [rw] glossary_config
|
673
|
+
# @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig]
|
674
|
+
# The `glossary_config` used for this translation.
|
675
|
+
class TranslateDocumentResponse
|
676
|
+
include ::Google::Protobuf::MessageExts
|
677
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
678
|
+
end
|
679
|
+
|
449
680
|
# The batch translation request.
|
450
681
|
# @!attribute [rw] parent
|
451
682
|
# @return [::String]
|
@@ -477,7 +708,6 @@ module Google
|
|
477
708
|
#
|
478
709
|
# - General (built-in) models:
|
479
710
|
# `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
|
480
|
-
# `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
|
481
711
|
#
|
482
712
|
#
|
483
713
|
# If the map is empty or a specific model is
|
@@ -485,7 +715,7 @@ module Google
|
|
485
715
|
# @!attribute [rw] input_configs
|
486
716
|
# @return [::Array<::Google::Cloud::Translate::V3::InputConfig>]
|
487
717
|
# Required. Input configurations.
|
488
|
-
# The total number of files matched should be <=
|
718
|
+
# The total number of files matched should be <= 100.
|
489
719
|
# The total content size should be <= 100M Unicode codepoints.
|
490
720
|
# The files must use UTF-8 encoding.
|
491
721
|
# @!attribute [rw] output_config
|
@@ -506,7 +736,8 @@ module Google
|
|
506
736
|
# characters, underscores and dashes. International characters are allowed.
|
507
737
|
# Label values are optional. Label keys must start with a letter.
|
508
738
|
#
|
509
|
-
# See https://cloud.google.com/translate/docs/labels for more
|
739
|
+
# See https://cloud.google.com/translate/docs/advanced/labels for more
|
740
|
+
# information.
|
510
741
|
class BatchTranslateTextRequest
|
511
742
|
include ::Google::Protobuf::MessageExts
|
512
743
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -636,9 +867,8 @@ module Google
|
|
636
867
|
# For equivalent term sets glossaries:
|
637
868
|
#
|
638
869
|
# - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
|
639
|
-
# in multiple languages.
|
640
|
-
#
|
641
|
-
# glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
|
870
|
+
# in multiple languages. See documentation for more information -
|
871
|
+
# [glossaries](https://cloud.google.com/translate/docs/advanced/glossary).
|
642
872
|
class GlossaryInputConfig
|
643
873
|
include ::Google::Protobuf::MessageExts
|
644
874
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -745,7 +975,20 @@ module Google
|
|
745
975
|
# @!attribute [rw] filter
|
746
976
|
# @return [::String]
|
747
977
|
# Optional. Filter specifying constraints of a list operation.
|
748
|
-
#
|
978
|
+
# Specify the constraint by the format of "key=value", where key must be
|
979
|
+
# "src" or "tgt", and the value must be a valid language code.
|
980
|
+
# For multiple restrictions, concatenate them by "AND" (uppercase only),
|
981
|
+
# such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used
|
982
|
+
# here, which means using 'en-US' and 'en' can lead to different results,
|
983
|
+
# which depends on the language code you used when you create the glossary.
|
984
|
+
# For the unidirectional glossaries, the "src" and "tgt" add restrictions
|
985
|
+
# on the source and target language code separately.
|
986
|
+
# For the equivalent term set glossaries, the "src" and/or "tgt" add
|
987
|
+
# restrictions on the term set.
|
988
|
+
# For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional
|
989
|
+
# glossaries which exactly match the source language code as "en-US" and the
|
990
|
+
# target language code "zh-CN", but all equivalent term set glossaries which
|
991
|
+
# contain "en-US" and "zh-CN" in their language set will be picked.
|
749
992
|
# If missing, no filtering is performed.
|
750
993
|
class ListGlossariesRequest
|
751
994
|
include ::Google::Protobuf::MessageExts
|
@@ -862,6 +1105,297 @@ module Google
|
|
862
1105
|
include ::Google::Protobuf::MessageExts
|
863
1106
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
864
1107
|
end
|
1108
|
+
|
1109
|
+
# The BatchTranslateDocument request.
|
1110
|
+
# @!attribute [rw] parent
|
1111
|
+
# @return [::String]
|
1112
|
+
# Required. Location to make a regional call.
|
1113
|
+
#
|
1114
|
+
# Format: `projects/{project-number-or-id}/locations/{location-id}`.
|
1115
|
+
#
|
1116
|
+
# The `global` location is not supported for batch translation.
|
1117
|
+
#
|
1118
|
+
# Only AutoML Translation models or glossaries within the same region (have
|
1119
|
+
# the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
|
1120
|
+
# error is returned.
|
1121
|
+
# @!attribute [rw] source_language_code
|
1122
|
+
# @return [::String]
|
1123
|
+
# Required. The BCP-47 language code of the input document if known, for
|
1124
|
+
# example, "en-US" or "sr-Latn". Supported language codes are listed in
|
1125
|
+
# Language Support (https://cloud.google.com/translate/docs/languages).
|
1126
|
+
# @!attribute [rw] target_language_codes
|
1127
|
+
# @return [::Array<::String>]
|
1128
|
+
# Required. The BCP-47 language code to use for translation of the input
|
1129
|
+
# document. Specify up to 10 language codes here.
|
1130
|
+
# @!attribute [rw] input_configs
|
1131
|
+
# @return [::Array<::Google::Cloud::Translate::V3::BatchDocumentInputConfig>]
|
1132
|
+
# Required. Input configurations.
|
1133
|
+
# The total number of files matched should be <= 100.
|
1134
|
+
# The total content size to translate should be <= 100M Unicode codepoints.
|
1135
|
+
# The files must use UTF-8 encoding.
|
1136
|
+
# @!attribute [rw] output_config
|
1137
|
+
# @return [::Google::Cloud::Translate::V3::BatchDocumentOutputConfig]
|
1138
|
+
# Required. Output configuration.
|
1139
|
+
# If 2 input configs match to the same file (that is, same input path),
|
1140
|
+
# we don't generate output for duplicate inputs.
|
1141
|
+
# @!attribute [rw] models
|
1142
|
+
# @return [::Google::Protobuf::Map{::String => ::String}]
|
1143
|
+
# Optional. The models to use for translation. Map's key is target language
|
1144
|
+
# code. Map's value is the model name. Value can be a built-in general model,
|
1145
|
+
# or an AutoML Translation model.
|
1146
|
+
#
|
1147
|
+
# The value format depends on model type:
|
1148
|
+
#
|
1149
|
+
# - AutoML Translation models:
|
1150
|
+
# `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
|
1151
|
+
#
|
1152
|
+
# - General (built-in) models:
|
1153
|
+
# `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
|
1154
|
+
#
|
1155
|
+
#
|
1156
|
+
# If the map is empty or a specific model is
|
1157
|
+
# not requested for a language pair, then default google model (nmt) is used.
|
1158
|
+
# @!attribute [rw] glossaries
|
1159
|
+
# @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig}]
|
1160
|
+
# Optional. Glossaries to be applied. It's keyed by target language code.
|
1161
|
+
# @!attribute [rw] format_conversions
|
1162
|
+
# @return [::Google::Protobuf::Map{::String => ::String}]
|
1163
|
+
# Optional. File format conversion map to be applied to all input files.
|
1164
|
+
# Map's key is the original mime_type. Map's value is the target mime_type of
|
1165
|
+
# translated documents.
|
1166
|
+
#
|
1167
|
+
# Supported file format conversion includes:
|
1168
|
+
# - `application/pdf` to
|
1169
|
+
# `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
|
1170
|
+
#
|
1171
|
+
# If nothing specified, output files will be in the same format as the
|
1172
|
+
# original file.
|
1173
|
+
class BatchTranslateDocumentRequest
|
1174
|
+
include ::Google::Protobuf::MessageExts
|
1175
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1176
|
+
|
1177
|
+
# @!attribute [rw] key
|
1178
|
+
# @return [::String]
|
1179
|
+
# @!attribute [rw] value
|
1180
|
+
# @return [::String]
|
1181
|
+
class ModelsEntry
|
1182
|
+
include ::Google::Protobuf::MessageExts
|
1183
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1184
|
+
end
|
1185
|
+
|
1186
|
+
# @!attribute [rw] key
|
1187
|
+
# @return [::String]
|
1188
|
+
# @!attribute [rw] value
|
1189
|
+
# @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig]
|
1190
|
+
class GlossariesEntry
|
1191
|
+
include ::Google::Protobuf::MessageExts
|
1192
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1193
|
+
end
|
1194
|
+
|
1195
|
+
# @!attribute [rw] key
|
1196
|
+
# @return [::String]
|
1197
|
+
# @!attribute [rw] value
|
1198
|
+
# @return [::String]
|
1199
|
+
class FormatConversionsEntry
|
1200
|
+
include ::Google::Protobuf::MessageExts
|
1201
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1202
|
+
end
|
1203
|
+
end
|
1204
|
+
|
1205
|
+
# Input configuration for BatchTranslateDocument request.
|
1206
|
+
# @!attribute [rw] gcs_source
|
1207
|
+
# @return [::Google::Cloud::Translate::V3::GcsSource]
|
1208
|
+
# Google Cloud Storage location for the source input.
|
1209
|
+
# This can be a single file (for example,
|
1210
|
+
# `gs://translation-test/input.docx`) or a wildcard (for example,
|
1211
|
+
# `gs://translation-test/*`).
|
1212
|
+
#
|
1213
|
+
# File mime type is determined based on extension. Supported mime type
|
1214
|
+
# includes:
|
1215
|
+
# - `pdf`, application/pdf
|
1216
|
+
# - `docx`,
|
1217
|
+
# application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
1218
|
+
# - `pptx`,
|
1219
|
+
# application/vnd.openxmlformats-officedocument.presentationml.presentation
|
1220
|
+
# - `xlsx`,
|
1221
|
+
# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
1222
|
+
#
|
1223
|
+
# The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
|
1224
|
+
# The max file size to support for `.pdf` is 1GB and the max page limit is
|
1225
|
+
# 1000 pages.
|
1226
|
+
# The max file size to support for all input documents is 1GB.
|
1227
|
+
class BatchDocumentInputConfig
|
1228
|
+
include ::Google::Protobuf::MessageExts
|
1229
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1230
|
+
end
|
1231
|
+
|
1232
|
+
# Output configuration for BatchTranslateDocument request.
|
1233
|
+
# @!attribute [rw] gcs_destination
|
1234
|
+
# @return [::Google::Cloud::Translate::V3::GcsDestination]
|
1235
|
+
# Google Cloud Storage destination for output content.
|
1236
|
+
# For every single input document (for example, gs://a/b/c.[extension]), we
|
1237
|
+
# generate at most 2 * n output files. (n is the # of target_language_codes
|
1238
|
+
# in the BatchTranslateDocumentRequest).
|
1239
|
+
#
|
1240
|
+
# While the input documents are being processed, we write/update an index
|
1241
|
+
# file `index.csv` under `gcs_destination.output_uri_prefix` (for example,
|
1242
|
+
# gs://translation_output/index.csv) The index file is generated/updated as
|
1243
|
+
# new files are being translated. The format is:
|
1244
|
+
#
|
1245
|
+
# input_document,target_language_code,translation_output,error_output,
|
1246
|
+
# glossary_translation_output,glossary_error_output
|
1247
|
+
#
|
1248
|
+
# `input_document` is one file we matched using gcs_source.input_uri.
|
1249
|
+
# `target_language_code` is provided in the request.
|
1250
|
+
# `translation_output` contains the translations. (details provided below)
|
1251
|
+
# `error_output` contains the error message during processing of the file.
|
1252
|
+
# Both translations_file and errors_file could be empty strings if we have
|
1253
|
+
# no content to output.
|
1254
|
+
# `glossary_translation_output` and `glossary_error_output` are the
|
1255
|
+
# translated output/error when we apply glossaries. They could also be
|
1256
|
+
# empty if we have no content to output.
|
1257
|
+
#
|
1258
|
+
# Once a row is present in index.csv, the input/output matching never
|
1259
|
+
# changes. Callers should also expect all the content in input_file are
|
1260
|
+
# processed and ready to be consumed (that is, no partial output file is
|
1261
|
+
# written).
|
1262
|
+
#
|
1263
|
+
# Since index.csv will be keeping updated during the process, please make
|
1264
|
+
# sure there is no custom retention policy applied on the output bucket
|
1265
|
+
# that may avoid file updating.
|
1266
|
+
# (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy)
|
1267
|
+
#
|
1268
|
+
# The naming format of translation output files follows (for target
|
1269
|
+
# language code [trg]): `translation_output`:
|
1270
|
+
# gs://translation_output/a_b_c_[trg]_translation.[extension]
|
1271
|
+
# `glossary_translation_output`:
|
1272
|
+
# gs://translation_test/a_b_c_[trg]_glossary_translation.[extension] The
|
1273
|
+
# output document will maintain the same file format as the input document.
|
1274
|
+
#
|
1275
|
+
# The naming format of error output files follows (for target language code
|
1276
|
+
# [trg]): `error_output`: gs://translation_test/a_b_c_[trg]_errors.txt
|
1277
|
+
# `glossary_error_output`:
|
1278
|
+
# gs://translation_test/a_b_c_[trg]_glossary_translation.txt The error
|
1279
|
+
# output is a txt file containing error details.
|
1280
|
+
class BatchDocumentOutputConfig
|
1281
|
+
include ::Google::Protobuf::MessageExts
|
1282
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1283
|
+
end
|
1284
|
+
|
1285
|
+
# Stored in the
|
1286
|
+
# {::Google::Longrunning::Operation#response google.longrunning.Operation.response}
|
1287
|
+
# field returned by BatchTranslateDocument if at least one document is
|
1288
|
+
# translated successfully.
|
1289
|
+
# @!attribute [rw] total_pages
|
1290
|
+
# @return [::Integer]
|
1291
|
+
# Total number of pages to translate in all documents. Documents without
|
1292
|
+
# clear page definition (such as XLSX) are not counted.
|
1293
|
+
# @!attribute [rw] translated_pages
|
1294
|
+
# @return [::Integer]
|
1295
|
+
# Number of successfully translated pages in all documents. Documents without
|
1296
|
+
# clear page definition (such as XLSX) are not counted.
|
1297
|
+
# @!attribute [rw] failed_pages
|
1298
|
+
# @return [::Integer]
|
1299
|
+
# Number of pages that failed to process in all documents. Documents without
|
1300
|
+
# clear page definition (such as XLSX) are not counted.
|
1301
|
+
# @!attribute [rw] total_billable_pages
|
1302
|
+
# @return [::Integer]
|
1303
|
+
# Number of billable pages in documents with clear page definition (such as
|
1304
|
+
# PDF, DOCX, PPTX)
|
1305
|
+
# @!attribute [rw] total_characters
|
1306
|
+
# @return [::Integer]
|
1307
|
+
# Total number of characters (Unicode codepoints) in all documents.
|
1308
|
+
# @!attribute [rw] translated_characters
|
1309
|
+
# @return [::Integer]
|
1310
|
+
# Number of successfully translated characters (Unicode codepoints) in all
|
1311
|
+
# documents.
|
1312
|
+
# @!attribute [rw] failed_characters
|
1313
|
+
# @return [::Integer]
|
1314
|
+
# Number of characters that have failed to process (Unicode codepoints) in
|
1315
|
+
# all documents.
|
1316
|
+
# @!attribute [rw] total_billable_characters
|
1317
|
+
# @return [::Integer]
|
1318
|
+
# Number of billable characters (Unicode codepoints) in documents without
|
1319
|
+
# clear page definition, such as XLSX.
|
1320
|
+
# @!attribute [rw] submit_time
|
1321
|
+
# @return [::Google::Protobuf::Timestamp]
|
1322
|
+
# Time when the operation was submitted.
|
1323
|
+
# @!attribute [rw] end_time
|
1324
|
+
# @return [::Google::Protobuf::Timestamp]
|
1325
|
+
# The time when the operation is finished and
|
1326
|
+
# {::Google::Longrunning::Operation#done google.longrunning.Operation.done} is
|
1327
|
+
# set to true.
|
1328
|
+
class BatchTranslateDocumentResponse
|
1329
|
+
include ::Google::Protobuf::MessageExts
|
1330
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1331
|
+
end
|
1332
|
+
|
1333
|
+
# State metadata for the batch translation operation.
|
1334
|
+
# @!attribute [rw] state
|
1335
|
+
# @return [::Google::Cloud::Translate::V3::BatchTranslateDocumentMetadata::State]
|
1336
|
+
# The state of the operation.
|
1337
|
+
# @!attribute [rw] total_pages
|
1338
|
+
# @return [::Integer]
|
1339
|
+
# Total number of pages to translate in all documents so far. Documents
|
1340
|
+
# without clear page definition (such as XLSX) are not counted.
|
1341
|
+
# @!attribute [rw] translated_pages
|
1342
|
+
# @return [::Integer]
|
1343
|
+
# Number of successfully translated pages in all documents so far. Documents
|
1344
|
+
# without clear page definition (such as XLSX) are not counted.
|
1345
|
+
# @!attribute [rw] failed_pages
|
1346
|
+
# @return [::Integer]
|
1347
|
+
# Number of pages that failed to process in all documents so far. Documents
|
1348
|
+
# without clear page definition (such as XLSX) are not counted.
|
1349
|
+
# @!attribute [rw] total_billable_pages
|
1350
|
+
# @return [::Integer]
|
1351
|
+
# Number of billable pages in documents with clear page definition (such as
|
1352
|
+
# PDF, DOCX, PPTX) so far.
|
1353
|
+
# @!attribute [rw] total_characters
|
1354
|
+
# @return [::Integer]
|
1355
|
+
# Total number of characters (Unicode codepoints) in all documents so far.
|
1356
|
+
# @!attribute [rw] translated_characters
|
1357
|
+
# @return [::Integer]
|
1358
|
+
# Number of successfully translated characters (Unicode codepoints) in all
|
1359
|
+
# documents so far.
|
1360
|
+
# @!attribute [rw] failed_characters
|
1361
|
+
# @return [::Integer]
|
1362
|
+
# Number of characters that have failed to process (Unicode codepoints) in
|
1363
|
+
# all documents so far.
|
1364
|
+
# @!attribute [rw] total_billable_characters
|
1365
|
+
# @return [::Integer]
|
1366
|
+
# Number of billable characters (Unicode codepoints) in documents without
|
1367
|
+
# clear page definition (such as XLSX) so far.
|
1368
|
+
# @!attribute [rw] submit_time
|
1369
|
+
# @return [::Google::Protobuf::Timestamp]
|
1370
|
+
# Time when the operation was submitted.
|
1371
|
+
class BatchTranslateDocumentMetadata
|
1372
|
+
include ::Google::Protobuf::MessageExts
|
1373
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1374
|
+
|
1375
|
+
# State of the job.
|
1376
|
+
module State
|
1377
|
+
# Invalid.
|
1378
|
+
STATE_UNSPECIFIED = 0
|
1379
|
+
|
1380
|
+
# Request is being processed.
|
1381
|
+
RUNNING = 1
|
1382
|
+
|
1383
|
+
# The batch is processed, and at least one item was successfully processed.
|
1384
|
+
SUCCEEDED = 2
|
1385
|
+
|
1386
|
+
# The batch is done and no item was successfully processed.
|
1387
|
+
FAILED = 3
|
1388
|
+
|
1389
|
+
# Request is in the process of being canceled after caller invoked
|
1390
|
+
# longrunning.Operations.CancelOperation on the request id.
|
1391
|
+
CANCELLING = 4
|
1392
|
+
|
1393
|
+
# The batch is done after the user has called the
|
1394
|
+
# longrunning.Operations.CancelOperation. Any records processed before the
|
1395
|
+
# cancel command are output as specified in the request.
|
1396
|
+
CANCELLED = 5
|
1397
|
+
end
|
1398
|
+
end
|
865
1399
|
end
|
866
1400
|
end
|
867
1401
|
end
|