Skip to content

Commit

Permalink
feat: regenrate language translator
Browse files Browse the repository at this point in the history
  • Loading branch information
mamoonraja committed Nov 16, 2020
1 parent 5af17b7 commit 8fdebc4
Showing 1 changed file with 34 additions and 17 deletions.
51 changes: 34 additions & 17 deletions ibm_watson/language_translator_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class LanguageTranslatorV3(BaseService):
DEFAULT_SERVICE_NAME = 'language_translator'

def __init__(
self,
version: str,
authenticator: Authenticator = None,
service_name: str = DEFAULT_SERVICE_NAME,
self,
version: str,
authenticator: Authenticator = None,
service_name: str = DEFAULT_SERVICE_NAME,
) -> None:
"""
Construct a new client for the Language Translator service.
Expand Down Expand Up @@ -87,9 +87,12 @@ def list_languages(self, **kwargs) -> 'DetailedResponse':
"""
List supported languages.
Lists all supported languages. The method returns an array of supported languages
with information about each language. Languages are listed in alphabetical order
by language code (for example, `af`, `ar`).
Lists all supported languages for translation. The method returns an array of
supported languages with information about each language. Languages are listed in
alphabetical order by language code (for example, `af`, `ar`). In addition to
basic information about each language, the response indicates whether the language
is `supported_as_source` for translation and `supported_as_target` for
translation. It also lists whether the language is `identifiable`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
Expand Down Expand Up @@ -135,9 +138,12 @@ def translate(self,
service attempt to detect the language from the input text. If you omit the source
language, the request must contain sufficient input text for the service to
identify the source language.
You can translate a maximum of 50 KB (51,200 bytes) of text with a single request.
All input text must be encoded in UTF-8 format.
:param List[str] text: Input text in UTF-8 encoding. Multiple entries
result in multiple translations in the response.
:param List[str] text: Input text in UTF-8 encoding. Submit a maximum of 50
KB (51,200 bytes) of text with a single request. Multiple elements result
in multiple translations in the response.
:param str model_id: (optional) The model to use for translation. For
example, `en-de` selects the IBM-provided base model for English-to-German
translation. A model ID overrides the `source` and `target` parameters and
Expand Down Expand Up @@ -350,9 +356,13 @@ def create_model(self,
* **XLIFF** (`.xliff`) - XML Localization Interchange File Format (XLIFF) is an
XML specification for the exchange of translation memories.
* **CSV** (`.csv`) - Comma-separated values (CSV) file with two columns for
aligned sentences and phrases. The first row contains the language code.
aligned sentences and phrases. The first row must have two language codes. The
first column is for the source language code, and the second column is for the
target language code.
* **TSV** (`.tsv` or `.tab`) - Tab-separated values (TSV) file with two columns
for aligned sentences and phrases. The first row contains the language code.
for aligned sentences and phrases. The first row must have two language codes. The
first column is for the source language code, and the second column is for the
target language code.
* **JSON** (`.json`) - Custom JSON format for specifying aligned sentences and
phrases.
* **Microsoft Excel** (`.xls` or `.xlsx`) - Excel file with the first two columns
Expand Down Expand Up @@ -564,12 +574,16 @@ def translate_document(self,
Submit a document for translation. You can submit the document contents in the
`file` parameter, or you can reference a previously submitted document by document
ID.
:param TextIO file: The contents of the source file to translate.
[Supported file
types](https://cloud.ibm.com/docs/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats)
Maximum file size: **20 MB**.
ID. The maximum file size for document translation is
* 20 MB for service instances on the Standard, Advanced, and Premium plans
* 2 MB for service instances on the Lite plan.
:param TextIO file: The contents of the source file to translate. The
maximum file size for document translation is 20 MB for service instances
on the Standard, Advanced, and Premium plans, and 2 MB for service
instances on the Lite plan. For more information, see [Supported file
formats
(Beta)](https://cloud.ibm.com/docs/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats).
:param str filename: (optional) The filename for file.
:param str file_content_type: (optional) The content type of file.
:param str model_id: (optional) The model to use for translation. For
Expand Down Expand Up @@ -785,6 +799,9 @@ class FileContentType(Enum):
TEXT_PLAIN = 'text/plain'
TEXT_RICHTEXT = 'text/richtext'
TEXT_RTF = 'text/rtf'
TEXT_SBV = 'text/sbv'
TEXT_SRT = 'text/srt'
TEXT_VTT = 'text/vtt'
TEXT_XML = 'text/xml'


Expand Down

0 comments on commit 8fdebc4

Please sign in to comment.