langchain_community.document_transformers.google_translate.GoogleTranslateTransformer

class langchain_community.document_transformers.google_translate.GoogleTranslateTransformer(project_id: str, *, location: str = 'global', model_id: Optional[str] = None, glossary_id: Optional[str] = None, api_endpoint: Optional[str] = None)[source]

[Deprecated] 使用Google Cloud翻译文本文档。

Notes

Deprecated since version 0.0.32.

参数: project_id: Google Cloud 项目 ID。 location: (可选)翻译模型位置。 model_id: (可选)要使用的翻译模型 ID。 glossary_id: (可选)要使用的翻译词汇表 ID。 api_endpoint: (可选)要使用的区域端点。

Methods

__init__(project_id, *[, location, ...])

参数: project_id: Google Cloud 项目 ID。 location: (可选)翻译模型位置。 model_id: (可选)要使用的翻译模型 ID。 glossary_id: (可选)要使用的翻译词汇表 ID。 api_endpoint: (可选)要使用的区域端点。

atransform_documents(documents, **kwargs)

异步转换文档列表。

transform_documents(documents, **kwargs)

使用Google翻译来翻译文本文档。

Parameters
  • project_id (str) –

  • location (str) –

  • model_id (Optional[str]) –

  • glossary_id (Optional[str]) –

  • api_endpoint (Optional[str]) –

Return type

None

__init__(project_id: str, *, location: str = 'global', model_id: Optional[str] = None, glossary_id: Optional[str] = None, api_endpoint: Optional[str] = None) None[source]

参数: project_id: Google Cloud 项目 ID。 location: (可选)翻译模型位置。 model_id: (可选)要使用的翻译模型 ID。 glossary_id: (可选)要使用的翻译词汇表 ID。 api_endpoint: (可选)要使用的区域端点。

Parameters
  • project_id (str) –

  • location (str) –

  • model_id (Optional[str]) –

  • glossary_id (Optional[str]) –

  • api_endpoint (Optional[str]) –

Return type

None

async atransform_documents(documents: Sequence[Document], **kwargs: Any) Sequence[Document]

异步转换文档列表。

参数:

documents:要转换的文档序列。

返回:

转换后的文档列表。

Parameters
  • documents (Sequence[Document]) –

  • kwargs (Any) –

Return type

Sequence[Document]

transform_documents(documents: Sequence[Document], **kwargs: Any) Sequence[Document][source]

使用Google翻译来翻译文本文档。

参数:

source_language_code: 输入文档的ISO 639语言代码。 target_language_code: 输出文档的ISO 639语言代码。

mime_type: (可选)输入文本的媒体类型。

选项:text/plaintext/html

Parameters
  • documents (Sequence[Document]) –

  • kwargs (Any) –

Return type

Sequence[Document]

Examples using GoogleTranslateTransformer