All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.translate.model.TranslationSettings.kt Maven / Gradle / Ivy

There is a newer version: 1.3.78
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.translate.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Settings to configure your translation output. You can configure the following options:
 * + Brevity: reduces the length of the translation output for most translations. Available for `TranslateText` only.
 * + Formality: sets the formality level of the translation output.
 * + Profanity: masks profane words and phrases in the translation output.
 */
public class TranslationSettings private constructor(builder: Builder) {
    /**
     * 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.
     *
     * If you turn on brevity for a translation request with an unsupported language pair, the translation proceeds with the brevity setting turned off.
     *
     * For the language pairs that brevity supports, see [Using brevity](https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-brevity) in the Amazon Translate Developer Guide.
     */
    public val brevity: aws.sdk.kotlin.services.translate.model.Brevity? = builder.brevity
    /**
     * 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 [register](https://en.wikipedia.org/wiki/Register_(sociolinguistics))) in the translation output. You can set the value to informal or formal. If you don't specify a value for formality, or if the target language doesn't support formality, the translation will ignore the formality setting.
     *
     *  If you specify multiple target languages for the job, translate ignores the formality setting for any unsupported target language.
     *
     * For a list of target languages that support formality, see [Supported languages](https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-formality.html#customizing-translations-formality-languages) in the Amazon Translate Developer Guide.
     */
    public val formality: aws.sdk.kotlin.services.translate.model.Formality? = builder.formality
    /**
     * You can enable the profanity setting if you want to mask profane words and phrases in your translation output.
     *
     * 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 length or number of words.
     *
     * Amazon Translate doesn't detect profanity in all of its supported languages. For languages that don't support profanity detection, see [Unsupported languages](https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-profanity.html#customizing-translations-profanity-languages) in the Amazon Translate Developer Guide.
     *
     * If you specify multiple target languages for the job, all the target languages must support profanity masking. If any of the target languages don't support profanity masking, the translation job won't mask profanity for any target language.
     */
    public val profanity: aws.sdk.kotlin.services.translate.model.Profanity? = builder.profanity

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.translate.model.TranslationSettings = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("TranslationSettings(")
        append("brevity=$brevity,")
        append("formality=$formality,")
        append("profanity=$profanity")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = brevity?.hashCode() ?: 0
        result = 31 * result + (formality?.hashCode() ?: 0)
        result = 31 * result + (profanity?.hashCode() ?: 0)
        return result
    }

    override fun equals(other: kotlin.Any?): kotlin.Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as TranslationSettings

        if (brevity != other.brevity) return false
        if (formality != other.formality) return false
        if (profanity != other.profanity) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.translate.model.TranslationSettings = Builder(this).apply(block).build()

    @SdkDsl
    public class Builder {
        /**
         * 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.
         *
         * If you turn on brevity for a translation request with an unsupported language pair, the translation proceeds with the brevity setting turned off.
         *
         * For the language pairs that brevity supports, see [Using brevity](https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-brevity) in the Amazon Translate Developer Guide.
         */
        public var brevity: aws.sdk.kotlin.services.translate.model.Brevity? = null
        /**
         * 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 [register](https://en.wikipedia.org/wiki/Register_(sociolinguistics))) in the translation output. You can set the value to informal or formal. If you don't specify a value for formality, or if the target language doesn't support formality, the translation will ignore the formality setting.
         *
         *  If you specify multiple target languages for the job, translate ignores the formality setting for any unsupported target language.
         *
         * For a list of target languages that support formality, see [Supported languages](https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-formality.html#customizing-translations-formality-languages) in the Amazon Translate Developer Guide.
         */
        public var formality: aws.sdk.kotlin.services.translate.model.Formality? = null
        /**
         * You can enable the profanity setting if you want to mask profane words and phrases in your translation output.
         *
         * 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 length or number of words.
         *
         * Amazon Translate doesn't detect profanity in all of its supported languages. For languages that don't support profanity detection, see [Unsupported languages](https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-profanity.html#customizing-translations-profanity-languages) in the Amazon Translate Developer Guide.
         *
         * If you specify multiple target languages for the job, all the target languages must support profanity masking. If any of the target languages don't support profanity masking, the translation job won't mask profanity for any target language.
         */
        public var profanity: aws.sdk.kotlin.services.translate.model.Profanity? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.translate.model.TranslationSettings) : this() {
            this.brevity = x.brevity
            this.formality = x.formality
            this.profanity = x.profanity
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.translate.model.TranslationSettings = TranslationSettings(this)

        internal fun correctErrors(): Builder {
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy