Skip to content

Commit

Permalink
feat(client-translate): Added support for Brevity translation setting…
Browse files Browse the repository at this point in the history
…s feature.
  • Loading branch information
awstools committed Oct 31, 2023
1 parent d6cf665 commit 98b7567
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export interface CreateParallelDataCommandOutput extends CreateParallelDataRespo
* Name: "STRING_VALUE", // required
* Description: "STRING_VALUE",
* ParallelDataConfig: { // ParallelDataConfig
* S3Uri: "STRING_VALUE", // required
* Format: "TSV" || "CSV" || "TMX", // required
* S3Uri: "STRING_VALUE",
* Format: "TSV" || "CSV" || "TMX",
* },
* EncryptionKey: { // EncryptionKey
* Type: "KMS", // required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export interface DescribeTextTranslationJobCommandOutput extends DescribeTextTra
* // Settings: { // TranslationSettings
* // Formality: "FORMAL" || "INFORMAL",
* // Profanity: "MASK",
* // Brevity: "ON",
* // },
* // },
* // };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export interface GetParallelDataCommandOutput extends GetParallelDataResponse, _
* // "STRING_VALUE",
* // ],
* // ParallelDataConfig: { // ParallelDataConfig
* // S3Uri: "STRING_VALUE", // required
* // Format: "TSV" || "CSV" || "TMX", // required
* // S3Uri: "STRING_VALUE",
* // Format: "TSV" || "CSV" || "TMX",
* // },
* // Message: "STRING_VALUE",
* // ImportedDataSize: Number("long"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export interface ListParallelDataCommandOutput extends ListParallelDataResponse,
* // "STRING_VALUE",
* // ],
* // ParallelDataConfig: { // ParallelDataConfig
* // S3Uri: "STRING_VALUE", // required
* // Format: "TSV" || "CSV" || "TMX", // required
* // S3Uri: "STRING_VALUE",
* // Format: "TSV" || "CSV" || "TMX",
* // },
* // Message: "STRING_VALUE",
* // ImportedDataSize: Number("long"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export interface ListTextTranslationJobsCommandOutput extends ListTextTranslatio
* // Settings: { // TranslationSettings
* // Formality: "FORMAL" || "INFORMAL",
* // Profanity: "MASK",
* // Brevity: "ON",
* // },
* // },
* // ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export interface StartTextTranslationJobCommandOutput extends StartTextTranslati
* Settings: { // TranslationSettings
* Formality: "FORMAL" || "INFORMAL",
* Profanity: "MASK",
* Brevity: "ON",
* },
* };
* const command = new StartTextTranslationJobCommand(input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ export interface TranslateDocumentCommandOutput extends TranslateDocumentRespons
/**
* @public
* <p>Translates the input document from the source language to the target language.
* This synchronous operation supports plain text or HTML for the input document.
* This synchronous operation supports text, HTML, or Word documents as the input document.
*
* <code>TranslateDocument</code> supports translations from English to any supported language,
* and from any supported language to English. Therefore, specify either the source language code
* or the target language code as “en” (English).
* </p>
* <p>
* <code>TranslateDocument</code> does not support language auto-detection. </p>
* <p> If you set the <code>Formality</code> parameter, the request will fail if the target language does
* not support formality. For a list of target languages that support formality, see
* <a href="https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-formality.html">Setting formality</a>.
Expand All @@ -74,6 +72,7 @@ export interface TranslateDocumentCommandOutput extends TranslateDocumentRespons
* Settings: { // TranslationSettings
* Formality: "FORMAL" || "INFORMAL",
* Profanity: "MASK",
* Brevity: "ON",
* },
* };
* const command = new TranslateDocumentCommand(input);
Expand All @@ -98,6 +97,7 @@ export interface TranslateDocumentCommandOutput extends TranslateDocumentRespons
* // AppliedSettings: { // TranslationSettings
* // Formality: "FORMAL" || "INFORMAL",
* // Profanity: "MASK",
* // Brevity: "ON",
* // },
* // };
*
Expand Down
2 changes: 2 additions & 0 deletions clients/client-translate/src/commands/TranslateTextCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export interface TranslateTextCommandOutput extends TranslateTextResponse, __Met
* Settings: { // TranslationSettings
* Formality: "FORMAL" || "INFORMAL",
* Profanity: "MASK",
* Brevity: "ON",
* },
* };
* const command = new TranslateTextCommand(input);
Expand All @@ -77,6 +78,7 @@ export interface TranslateTextCommandOutput extends TranslateTextResponse, __Met
* // AppliedSettings: { // TranslationSettings
* // Formality: "FORMAL" || "INFORMAL",
* // Profanity: "MASK",
* // Brevity: "ON",
* // },
* // };
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export interface UpdateParallelDataCommandOutput extends UpdateParallelDataRespo
* Name: "STRING_VALUE", // required
* Description: "STRING_VALUE",
* ParallelDataConfig: { // ParallelDataConfig
* S3Uri: "STRING_VALUE", // required
* Format: "TSV" || "CSV" || "TMX", // required
* S3Uri: "STRING_VALUE",
* Format: "TSV" || "CSV" || "TMX",
* },
* ClientToken: "STRING_VALUE", // required
* };
Expand Down
117 changes: 100 additions & 17 deletions clients/client-translate/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ export interface ParallelDataConfig {
* <p>The URI of the Amazon S3 folder that contains the parallel data input file. The folder
* must be in the same Region as the API endpoint you are calling.</p>
*/
S3Uri: string | undefined;
S3Uri?: string;

/**
* @public
* <p>The format of the parallel data input file.</p>
*/
Format: ParallelDataFormat | undefined;
Format?: ParallelDataFormat;
}

/**
Expand Down Expand Up @@ -590,6 +590,19 @@ export interface OutputDataConfig {
EncryptionKey?: EncryptionKey;
}

/**
* @public
* @enum
*/
export const Brevity = {
ON: "ON",
} as const;

/**
* @public
*/
export type Brevity = (typeof Brevity)[keyof typeof Brevity];

/**
* @public
* @enum
Expand Down Expand Up @@ -619,13 +632,24 @@ export type Profanity = (typeof Profanity)[keyof typeof Profanity];

/**
* @public
* <p>Settings to configure your translation output, including the option to set the formality
* level of the output text and the option to mask profane words and phrases.</p>
* <p>Settings to configure your translation output. You can configure the following options:</p>
* <ul>
* <li>
* <p>Brevity: reduces the length of the translation output for most translations. Available for
* <code>TranslateText</code> only.</p>
* </li>
* <li>
* <p>Formality: sets the formality level of the translation output.</p>
* </li>
* <li>
* <p>Profanity: masks profane words and phrases in the translation output.</p>
* </li>
* </ul>
*/
export interface TranslationSettings {
/**
* @public
* <p>You can optionally specify the desired level of formality for translations
* <p>You can specify the desired level of formality for translations
* to supported target languages. The formality
* setting controls the level of formal language usage (also known as <a href="https://en.wikipedia.org/wiki/Register_(sociolinguistics)">register</a>) in the
* translation output. You can set the value to informal or formal. If you don't specify a value for
Expand All @@ -640,7 +664,7 @@ export interface TranslationSettings {

/**
* @public
* <p>Enable the profanity setting if you want Amazon Translate to mask profane words and
* <p>You can enable the profanity setting if you want to mask profane words and
* phrases in your translation output.</p>
* <p>To mask profane words and phrases, Amazon Translate replaces them with the grawlix string
* “?$#@$“. This 5-character sequence is used for each profane word or phrase, regardless of the
Expand All @@ -654,6 +678,18 @@ export interface TranslationSettings {
* language.</p>
*/
Profanity?: Profanity;

/**
* @public
* <p>When you turn on brevity, Amazon Translate reduces the length of the translation output for most translations (when
* compared with the same translation with brevity turned off). By default, brevity is turned
* off.</p>
* <p>If you turn on brevity for a translation request with an unsupported language pair, the
* translation proceeds with the brevity setting turned off.</p>
* <p>For the language pairs that brevity supports, see <a href="https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-brevity">Using brevity</a> in the
* Amazon Translate Developer Guide.</p>
*/
Brevity?: Brevity;
}

/**
Expand Down Expand Up @@ -1727,8 +1763,18 @@ export interface StartTextTranslationJobRequest {

/**
* @public
* <p>Settings to configure your translation output, including the option to set the formality
* level of the output text and the option to mask profane words and phrases.</p>
* <p>Settings to configure your translation output. You can configure the following options:</p>
* <ul>
* <li>
* <p>Brevity: not supported.</p>
* </li>
* <li>
* <p>Formality: sets the formality level of the output text.</p>
* </li>
* <li>
* <p>Profanity: masks profane words and phrases in your translation output.</p>
* </li>
* </ul>
*/
Settings?: TranslationSettings;
}
Expand Down Expand Up @@ -1960,10 +2006,16 @@ export interface TranslateDocumentRequest {

/**
* @public
* <p>The language code for the language of the source text. Do not use <code>auto</code>, because
* <code>TranslateDocument</code> does not support language auto-detection.
* For a list of supported language codes, see
* <p>The language code for the language of the source text. For a list of supported language codes, see
* <a href="https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html">Supported languages</a>.</p>
* <p>To have Amazon Translate determine the source language of your text, you can specify
* <code>auto</code> in the <code>SourceLanguageCode</code> field. If you specify
* <code>auto</code>, Amazon Translate will call <a href="https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-general.html">Amazon
* Comprehend</a> to determine the source language.</p>
* <note>
* <p>If you specify <code>auto</code>, you must send the <code>TranslateDocument</code> request in a region that supports
* Amazon Comprehend. Otherwise, the request returns an error indicating that autodetect is not supported. </p>
* </note>
*/
SourceLanguageCode: string | undefined;

Expand All @@ -1977,8 +2029,18 @@ export interface TranslateDocumentRequest {

/**
* @public
* <p>Settings to configure your translation output, including the option to set the formality
* level of the output text and the option to mask profane words and phrases.</p>
* <p>Settings to configure your translation output. You can configure the following options:</p>
* <ul>
* <li>
* <p>Brevity: not supported.</p>
* </li>
* <li>
* <p>Formality: sets the formality level of the output text.</p>
* </li>
* <li>
* <p>Profanity: masks profane words and phrases in your translation output.</p>
* </li>
* </ul>
*/
Settings?: TranslationSettings;
}
Expand Down Expand Up @@ -2026,8 +2088,19 @@ export interface TranslateDocumentResponse {

/**
* @public
* <p>Settings to configure your translation output, including the option to set the formality
* level of the output text and the option to mask profane words and phrases.</p>
* <p>Settings to configure your translation output. You can configure the following options:</p>
* <ul>
* <li>
* <p>Brevity: reduces the length of the translation output for most translations. Available for
* <code>TranslateText</code> only.</p>
* </li>
* <li>
* <p>Formality: sets the formality level of the translation output.</p>
* </li>
* <li>
* <p>Profanity: masks profane words and phrases in the translation output.</p>
* </li>
* </ul>
*/
AppliedSettings?: TranslationSettings;
}
Expand Down Expand Up @@ -2132,8 +2205,18 @@ export interface TranslateTextRequest {

/**
* @public
* <p>Settings to configure your translation output, including the option to set the formality
* level of the output text and the option to mask profane words and phrases.</p>
* <p>Settings to configure your translation output. You can configure the following options:</p>
* <ul>
* <li>
* <p>Brevity: reduces the length of the translated output for most translations.</p>
* </li>
* <li>
* <p>Formality: sets the formality level of the output text.</p>
* </li>
* <li>
* <p>Profanity: masks profane words and phrases in your translation output.</p>
* </li>
* </ul>
*/
Settings?: TranslationSettings;
}
Expand Down
Loading

0 comments on commit 98b7567

Please sign in to comment.