TranslationServiceClient 클래스 (3.12.0)

TranslationServiceClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.translate_v3.services.translation_service.transports.base.TranslationServiceTransport]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)

자연어 번역 작업을 제공합니다.

속성

전송

클라이언트 인스턴스에서 사용한 전송을 반환합니다.

반환
유형설명
TranslationServiceTransport클라이언트 인스턴스에서 사용되는 전송입니다.

메서드

TranslationServiceClient

TranslationServiceClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.translate_v3.services.translation_service.transports.base.TranslationServiceTransport]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)

번역 서비스 클라이언트를 인스턴스화합니다.

매개변수
이름설명
credentials Optional[google.auth.credentials.Credentials]

요청에 연결할 승인 사용자 인증 정보입니다. 이 사용자 인증 정보는 서비스에 애플리케이션을 식별합니다. 지정된 사용자 인증 정보가 없으면 클라이언트가 환경에서 사용자 인증 정보를 확인하려고 시도합니다.

transport Union[str, TranslationServiceTransport]

사용할 전송입니다. None으로 설정하면 전송이 자동으로 선택됩니다.

client_options Optional[Union[google.api_core.client_options.ClientOptions, dict]]

클라이언트의 맞춤 옵션입니다. transport 인스턴스가 제공되면 적용되지 않습니다. (1) api_endpoint 속성을 사용하여 클라이언트에서 제공하는 기본 엔드포인트를 재정의할 수 있습니다. GOOGLE_API_USE_MTLS_ENDPOINT 환경 변수를 사용하여 엔드포인트를 재정의할 수도 있습니다('always'(항상 기본 mTLS 엔드포인트 사용), 'never'(항상 기본 일반 엔드포인트 사용), 'auto'(클라이언트 인증서가 있는 경우 기본 mTLS 엔드포인트로 자동 전환, 기본값)). 하지만 api_endpoint 속성이 제공되면 우선합니다. (2) GOOGLE_API_USE_CLIENT_CERTIFICATE 환경 변수가 'true'인 경우 client_cert_source 속성을 사용하여 상호 TLS 전송을 위한 클라이언트 인증서를 제공할 수 있습니다. 제공되지 않으면 기본 SSL 클라이언트 인증서가 있는 경우 사용됩니다. GOOGLE_API_USE_CLIENT_CERTIFICATE가 'false'이거나 설정되지 않은 경우 클라이언트 인증서가 사용되지 않습니다.

client_info google.api_core.gapic_v1.client_info.ClientInfo

API 요청과 함께 사용자 에이전트 문자열을 전송하는 데 사용되는 클라이언트 정보입니다. None인 경우 기본 정보가 사용됩니다. 일반적으로 자체 클라이언트 라이브러리를 개발하는 경우에만 이 값을 설정하면 됩니다.

예외
유형설명
google.auth.exceptions.MutualTLSChannelError어떤 이유로든 상호 TLS 전송 생성이 실패한 경우

__exit__

__exit__(type, value, traceback)

기본 전송 리소스를 해제합니다.

batch_translate_document

batch_translate_document(
    request: typing.Optional[
        typing.Union[
            google.cloud.translate_v3.types.translation_service.BatchTranslateDocumentRequest,
            dict,
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    source_language_code: typing.Optional[str] = None,
    target_language_codes: typing.Optional[typing.MutableSequence[str]] = None,
    input_configs: typing.Optional[
        typing.MutableSequence[
            google.cloud.translate_v3.types.translation_service.BatchDocumentInputConfig
        ]
    ] = None,
    output_config: typing.Optional[
        google.cloud.translate_v3.types.translation_service.BatchDocumentOutputConfig
    ] = None,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.operation.Operation

비동기 일괄 모드에서 대량의 문서를 번역합니다. 이 함수는 입력이 처리되는 동안 실시간 출력을 제공합니다. 호출자가 요청을 취소하면 부분 결과 (입력 파일의 경우 전부 또는 전무)가 지정된 출력 위치에서 계속 제공될 수 있습니다. 이 호출은 즉시 반환되며 google.longrunning.Operation.name을 사용하여 호출 상태를 폴링할 수 있습니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3

def sample_batch_translate_document():
    # Create a client
    client = translate_v3.TranslationServiceClient()

    # Initialize request argument(s)
    input_configs = translate_v3.BatchDocumentInputConfig()
    input_configs.gcs_source.input_uri = "input_uri_value"

    output_config = translate_v3.BatchDocumentOutputConfig()
    output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value"

    request = translate_v3.BatchTranslateDocumentRequest(
        parent="parent_value",
        source_language_code="source_language_code_value",
        target_language_codes=['target_language_codes_value1', 'target_language_codes_value2'],
        input_configs=input_configs,
        output_config=output_config,
    )

    # Make the request
    operation = client.batch_translate_document(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
매개변수
이름설명
request Union[google.cloud.translate_v3.types.BatchTranslateDocumentRequest, dict]

요청 객체입니다. BatchTranslateDocument 요청입니다.

parent str

필수 항목입니다. 리전 호출을 수행할 위치입니다. 형식은 projects/{project-number-or-id}/locations/{location-id}입니다. global 위치는 일괄 번역에 지원되지 않습니다. 동일한 리전 (동일한 location-id 보유) 내의 AutoML Translation 모델 또는 용어만 사용할 수 있습니다. 그렇지 않으면 INVALID_ARGUMENT (400) 오류가 반환됩니다. 이는 request 인스턴스의 parent 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

source_language_code str

필수 항목입니다. 입력 문서의 ISO-639 언어 코드입니다(예: 'en-US' 또는 'sr-Latn'). 지원되는 언어 코드는 Language Support https://cloud.google.com/translate/docs/languages__에 나열되어 있습니다. 이는 request 인스턴스의 source_language_code 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

target_language_codes MutableSequence[str]

필수 항목입니다. 입력 문서의 번역에 사용할 ISO-639 언어 코드입니다. 여기에 최대 10개의 언어 코드를 지정하세요. 이는 request 인스턴스의 target_language_codes 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

input_configs MutableSequence[google.cloud.translate_v3.types.BatchDocumentInputConfig]

필수 항목입니다. 입력 구성입니다. 일치하는 파일의 총수는 100개 이하여야 합니다. 번역할 총 콘텐츠 크기는 100M 유니코드 코드포인트 이하여야 합니다. 파일은 UTF-8 인코딩을 사용해야 합니다. 이는 request 인스턴스의 input_configs 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

output_config google.cloud.translate_v3.types.BatchDocumentOutputConfig

필수 항목입니다. 출력 구성입니다. 2개의 입력 구성이 동일한 파일 (즉, 동일한 입력 경로)과 일치하는 경우 중복 입력에 대한 출력이 생성되지 않습니다. 이는 request 인스턴스의 output_config 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.

반환
유형설명
google.api_core.operation.Operation장기 실행 작업을 나타내는 객체입니다. 하나 이상의 문서가 성공적으로 번역되면 작업의 결과 유형은 BatchTranslateDocument에서 반환된 google.longrunning.Operation.response][google.longrunning.Operation.response] 필드에 저장된 BatchTranslateDocumentResponse가 됩니다.

batch_translate_text

batch_translate_text(
    request: typing.Optional[
        typing.Union[
            google.cloud.translate_v3.types.translation_service.BatchTranslateTextRequest,
            dict,
        ]
    ] = None,
    *,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.operation.Operation

비동기 일괄 모드에서 대량의 텍스트를 번역합니다. 이 함수는 입력이 처리되는 동안 실시간 출력을 제공합니다. 호출자가 요청을 취소하면 부분 결과 (입력 파일의 경우 전부 또는 전무)가 지정된 출력 위치에서 계속 제공될 수 있습니다. 이 호출은 즉시 반환되며 google.longrunning.Operation.name을 사용하여 호출 상태를 폴링할 수 있습니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3

def sample_batch_translate_text():
    # Create a client
    client = translate_v3.TranslationServiceClient()

    # Initialize request argument(s)
    input_configs = translate_v3.InputConfig()
    input_configs.gcs_source.input_uri = "input_uri_value"

    output_config = translate_v3.OutputConfig()
    output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value"

    request = translate_v3.BatchTranslateTextRequest(
        parent="parent_value",
        source_language_code="source_language_code_value",
        target_language_codes=['target_language_codes_value1', 'target_language_codes_value2'],
        input_configs=input_configs,
        output_config=output_config,
    )

    # Make the request
    operation = client.batch_translate_text(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
매개변수
이름설명
request Union[google.cloud.translate_v3.types.BatchTranslateTextRequest, dict]

요청 객체입니다. 일괄 번역 요청입니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.

반환
유형설명
google.api_core.operation.Operation장기 실행 작업을 나타내는 객체입니다. 하나 이상의 문장이 성공적으로 번역되면 작업의 결과 유형은 BatchTranslateText에서 반환된 google.longrunning.Operation.response][google.longrunning.Operation.response] 필드에 저장된 BatchTranslateResponse가 됩니다.

create_glossary

create_glossary(
    request: typing.Optional[
        typing.Union[
            google.cloud.translate_v3.types.translation_service.CreateGlossaryRequest,
            dict,
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    glossary: typing.Optional[
        google.cloud.translate_v3.types.translation_service.Glossary
    ] = None,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.operation.Operation

용어집을 만들고 장기 실행 작업을 반환합니다. 프로젝트가 없는 경우 NOT_FOUND를 반환합니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3

def sample_create_glossary():
    # Create a client
    client = translate_v3.TranslationServiceClient()

    # Initialize request argument(s)
    glossary = translate_v3.Glossary()
    glossary.name = "name_value"

    request = translate_v3.CreateGlossaryRequest(
        parent="parent_value",
        glossary=glossary,
    )

    # Make the request
    operation = client.create_glossary(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
매개변수
이름설명
request Union[google.cloud.translate_v3.types.CreateGlossaryRequest, dict]

요청 객체입니다. CreateGlossary 요청 메시지입니다.

parent str

필수 항목입니다. 프로젝트 이름입니다. 이는 request 인스턴스의 parent 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

glossary google.cloud.translate_v3.types.Glossary

필수 항목입니다. 만들 용어집입니다. 이는 request 인스턴스의 glossary 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.

반환
유형설명
google.api_core.operation.Operation장기 실행 작업을 나타내는 객체입니다. 작업의 결과 유형은 Glossary입니다. 사용자 제공 데이터로 빌드된 용어집을 나타냅니다.

delete_glossary

delete_glossary(
    request: typing.Optional[
        typing.Union[
            google.cloud.translate_v3.types.translation_service.DeleteGlossaryRequest,
            dict,
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.operation.Operation

용어집을 삭제하거나 용어집이 아직 생성되지 않은 경우 용어집 생성을 취소합니다. 용어가 존재하지 않는 경우 NOT_FOUND를 반환합니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3

def sample_delete_glossary():
    # Create a client
    client = translate_v3.TranslationServiceClient()

    # Initialize request argument(s)
    request = translate_v3.DeleteGlossaryRequest(
        name="name_value",
    )

    # Make the request
    operation = client.delete_glossary(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
매개변수
이름설명
request Union[google.cloud.translate_v3.types.DeleteGlossaryRequest, dict]

요청 객체입니다. DeleteGlossary 요청 메시지입니다.

name str

필수 항목입니다. 삭제할 용어집의 이름입니다. 이는 request 인스턴스의 name 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.

반환
유형설명
google.api_core.operation.Operation장기 실행 작업을 나타내는 객체입니다. 작업의 결과 유형은 DeleteGlossary에서 반환된 google.longrunning.Operation.response][google.longrunning.Operation.response] 필드에 저장된 DeleteGlossaryResponse입니다.

detect_language

detect_language(
    request: typing.Optional[
        typing.Union[
            google.cloud.translate_v3.types.translation_service.DetectLanguageRequest,
            dict,
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    model: typing.Optional[str] = None,
    mime_type: typing.Optional[str] = None,
    content: typing.Optional[str] = None,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.translate_v3.types.translation_service.DetectLanguageResponse

요청에 포함된 텍스트의 언어를 감지합니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3

def sample_detect_language():
    # Create a client
    client = translate_v3.TranslationServiceClient()

    # Initialize request argument(s)
    request = translate_v3.DetectLanguageRequest(
        content="content_value",
        parent="parent_value",
    )

    # Make the request
    response = client.detect_language(request=request)

    # Handle the response
    print(response)
매개변수
이름설명
request Union[google.cloud.translate_v3.types.DetectLanguageRequest, dict]

요청 객체입니다. 언어 감지에 대한 요청 메시지입니다.

parent str

필수 항목입니다. 전화를 걸 프로젝트 또는 위치입니다. 호출자의 프로젝트를 참조해야 합니다. 형식: projects/{project-number-or-id}/locations/{location-id} 또는 projects/{project-number-or-id} 전역 호출의 경우 projects/{project-number-or-id}/locations/global 또는 projects/{project-number-or-id}을 사용합니다. 동일한 리전 (동일한 location-id 보유) 내의 모델만 사용할 수 있습니다. 그렇지 않으면 INVALID_ARGUMENT (400) 오류가 반환됩니다. 이는 request 인스턴스의 parent 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

model str

(선택사항) 사용할 언어 감지 모델입니다. 형식: projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id} 현재 지원되는 언어 감지 모델은 projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default 하나뿐입니다. 지정하지 않으면 기본 모델이 사용됩니다. 이는 request 인스턴스의 model 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

mime_type str

(선택사항) 소스 텍스트의 형식입니다(예: 'text/html', 'text/plain'). 비워 두면 MIME 유형은 기본적으로 'text/html'입니다. 이는 request 인스턴스의 mime_type 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

content str

문자열로 저장된 입력의 콘텐츠입니다. 이는 request 인스턴스의 content 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.

매개변수
이름설명
filename str

서비스 계정 비공개 키 json 파일의 경로입니다.

반환
유형설명
TranslationServiceClient구성된 클라이언트입니다.

get_glossary

get_glossary(
    request: typing.Optional[
        typing.Union[
            google.cloud.translate_v3.types.translation_service.GetGlossaryRequest, dict
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.translate_v3.types.translation_service.Glossary

용어집을 가져옵니다. 용어가 존재하지 않으면 NOT_FOUND를 반환합니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3

def sample_get_glossary():
    # Create a client
    client = translate_v3.TranslationServiceClient()

    # Initialize request argument(s)
    request = translate_v3.GetGlossaryRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_glossary(request=request)

    # Handle the response
    print(response)
매개변수
이름설명
request Union[google.cloud.translate_v3.types.GetGlossaryRequest, dict]

요청 객체입니다. GetGlossary 요청 메시지입니다.

name str

필수 항목입니다. 가져올 용어집의 이름입니다. 이는 request 인스턴스의 name 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.

예외
유형설명
google.auth.exceptions.MutualTLSChannelError오류가 발생한 경우
반환
유형설명
Tuple[str, Callable[[], Tuple[bytes, bytes]]]사용할 API 엔드포인트와 클라이언트 인증서 소스를 반환합니다.

get_supported_languages

get_supported_languages(
    request: typing.Optional[
        typing.Union[
            google.cloud.translate_v3.types.translation_service.GetSupportedLanguagesRequest,
            dict,
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    model: typing.Optional[str] = None,
    display_language_code: typing.Optional[str] = None,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.translate_v3.types.translation_service.SupportedLanguages

번역을 지원하는 언어 목록을 반환합니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3

def sample_get_supported_languages():
    # Create a client
    client = translate_v3.TranslationServiceClient()

    # Initialize request argument(s)
    request = translate_v3.GetSupportedLanguagesRequest(
        parent="parent_value",
    )

    # Make the request
    response = client.get_supported_languages(request=request)

    # Handle the response
    print(response)
매개변수
이름설명
request Union[google.cloud.translate_v3.types.GetSupportedLanguagesRequest, dict]

요청 객체입니다. 지원 언어 검색에 대한 요청 메시지입니다.

parent str

필수 항목입니다. 전화를 걸 프로젝트 또는 위치입니다. 호출자의 프로젝트를 참조해야 합니다. 형식: projects/{project-number-or-id} 또는 projects/{project-number-or-id}/locations/{location-id} 전역 호출의 경우 projects/{project-number-or-id}/locations/global 또는 projects/{project-number-or-id}을 사용합니다. AutoML 모델에는 전역이 아닌 위치가 필요합니다. 동일한 리전 (동일한 location-id 보유) 내의 모델만 사용할 수 있습니다. 그렇지 않으면 INVALID_ARGUMENT (400) 오류가 반환됩니다. 이는 request 인스턴스의 parent 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

model str

(선택사항) 이 모델의 지원 언어를 가져옵니다. 형식은 모델 유형에 따라 다릅니다. - AutoML Translation 모델: projects/{project-number-or-id}/locations/{location-id}/models/{model-id} - 일반 (내장) 모델: projects/{project-number-or-id}/locations/{location-id}/models/general/nmt, 지정된 모델에서 지원하는 언어를 반환합니다. 누락된 경우 Google 일반 NMT 모델의 지원되는 언어를 가져옵니다. 이는 request 인스턴스의 model 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

display_language_code str

(선택사항) 지원되는 언어 이름의 목록을 사람이 읽을 수 있는 형태로 현지화하여 반환하는 데 사용할 언어입니다. 누락된 경우 응답에 표시 이름이 반환되지 않습니다. 이는 request 인스턴스의 display_language_code 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.

반환
유형설명
google.cloud.translate_v3.types.SupportedLanguages지원 언어 검색에 대한 응답 메시지입니다.

glossary_path

glossary_path(project: str, location: str, glossary: str) -> str

정규화된 용어집 문자열을 반환합니다.

list_glossaries

list_glossaries(
    request: typing.Optional[
        typing.Union[
            google.cloud.translate_v3.types.translation_service.ListGlossariesRequest,
            dict,
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.translate_v3.services.translation_service.pagers.ListGlossariesPager

프로젝트의 용어집을 나열합니다. 프로젝트가 없으면 NOT_FOUND를 반환합니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3

def sample_list_glossaries():
    # Create a client
    client = translate_v3.TranslationServiceClient()

    # Initialize request argument(s)
    request = translate_v3.ListGlossariesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_glossaries(request=request)

    # Handle the response
    for response in page_result:
        print(response)
매개변수
이름설명
request Union[google.cloud.translate_v3.types.ListGlossariesRequest, dict]

요청 객체입니다. ListGlossaries 요청 메시지입니다.

parent str

필수 항목입니다. 모든 용어집을 나열할 프로젝트의 이름입니다. 이는 request 인스턴스의 parent 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.

반환
유형설명
google.cloud.translate_v3.services.translation_service.pagers.ListGlossariesPagerListGlossaries의 응답 메시지입니다. 이 객체를 반복하면 결과가 생성되고 추가 페이지가 자동으로 해결됩니다.

parse_glossary_path

parse_glossary_path(path: str) -> typing.Dict[str, str]

용어집 경로를 구성요소 세그먼트로 파싱합니다.

translate_document

translate_document(
    request: typing.Optional[
        typing.Union[
            google.cloud.translate_v3.types.translation_service.TranslateDocumentRequest,
            dict,
        ]
    ] = None,
    *,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.translate_v3.types.translation_service.TranslateDocumentResponse

동기 모드로 문서를 번역합니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3

def sample_translate_document():
    # Create a client
    client = translate_v3.TranslationServiceClient()

    # Initialize request argument(s)
    document_input_config = translate_v3.DocumentInputConfig()
    document_input_config.content = b'content_blob'

    request = translate_v3.TranslateDocumentRequest(
        parent="parent_value",
        target_language_code="target_language_code_value",
        document_input_config=document_input_config,
    )

    # Make the request
    response = client.translate_document(request=request)

    # Handle the response
    print(response)
매개변수
이름설명
request Union[google.cloud.translate_v3.types.TranslateDocumentRequest, dict]

요청 객체입니다. 문서 번역 요청입니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.

반환
유형설명
google.cloud.translate_v3.types.TranslateDocumentResponse번역된 문서 응답 메시지입니다.

translate_text

translate_text(
    request: typing.Optional[
        typing.Union[
            google.cloud.translate_v3.types.translation_service.TranslateTextRequest,
            dict,
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    target_language_code: typing.Optional[str] = None,
    contents: typing.Optional[typing.MutableSequence[str]] = None,
    model: typing.Optional[str] = None,
    mime_type: typing.Optional[str] = None,
    source_language_code: typing.Optional[str] = None,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.translate_v3.types.translation_service.TranslateTextResponse

입력 텍스트를 번역하고 번역된 텍스트를 반환합니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3

def sample_translate_text():
    # Create a client
    client = translate_v3.TranslationServiceClient()

    # Initialize request argument(s)
    request = translate_v3.TranslateTextRequest(
        contents=['contents_value1', 'contents_value2'],
        target_language_code="target_language_code_value",
        parent="parent_value",
    )

    # Make the request
    response = client.translate_text(request=request)

    # Handle the response
    print(response)
매개변수
이름설명
request Union[google.cloud.translate_v3.types.TranslateTextRequest, dict]

요청 객체입니다. 동기 번역의 요청 메시지입니다.

parent str

필수 항목입니다. 전화를 걸 프로젝트 또는 위치입니다. 호출자의 프로젝트를 참조해야 합니다. 형식: projects/{project-number-or-id} 또는 projects/{project-number-or-id}/locations/{location-id} 전역 호출의 경우 projects/{project-number-or-id}/locations/global 또는 projects/{project-number-or-id}을 사용합니다. AutoML 모델 또는 맞춤 용어집을 사용하는 요청에는 전역이 아닌 위치가 필요합니다. 모델과 용어집은 동일한 리전 (동일한 location-id)에 있어야 합니다. 그렇지 않으면 INVALID_ARGUMENT (400) 오류가 반환됩니다. 이는 request 인스턴스의 parent 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

target_language_code str

필수 항목입니다. 입력 텍스트의 번역에 사용할 ISO-639 언어 코드입니다. 언어 지원에 나열된 언어 코드 중 하나로 설정됩니다. 이는 request 인스턴스의 target_language_code 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

contents MutableSequence[str]

필수 항목입니다. 문자열 형식의 입력 콘텐츠입니다. 총 콘텐츠가 30,000코드 포인트 미만인 것이 좋습니다. 이 필드의 최대 길이는 1024입니다. 더 큰 텍스트에는 BatchTranslateText를 사용하세요. 이는 request 인스턴스의 contents 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

model str

(선택사항) 이 번역에 요청된 model 유형입니다. 형식은 모델 유형에 따라 다릅니다. - AutoML Translation 모델: projects/{project-number-or-id}/locations/{location-id}/models/{model-id} - 일반 (내장) 모델: projects/{project-number-or-id}/locations/{location-id}/models/general/nmt, 전역 (지역화되지 않음) 요청의 경우 location-id global 사용 예를 들면 projects/{project-number-or-id}/locations/global/models/general/nmt입니다. 제공되지 않으면 기본 Google 모델 (NMT)이 사용됩니다. 이는 request 인스턴스의 model 필드에 해당합니다. request가 제공되면 이를 설정하면 안 됩니다.

mime_type str

(선택사항) 소스 텍스트의 형식입니다(예: 'text/html', 'text/plain'). 비워 두면 MIME 유형은 기본적으로 'text/html'입니다. 이는 request 인스턴스의 mime_type 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

source_language_code str

(선택사항) 입력 텍스트의 ISO-639 언어 코드입니다(예: 'en-US' 또는 'sr-Latn'). 지원되는 언어 코드는 언어 지원에 나열되어 있습니다. 소스 언어가 지정되지 않으면 API에서 소스 언어를 자동으로 식별하려고 시도하고 응답 내에 소스 언어를 반환합니다. 이는 request 인스턴스의 source_language_code 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.