TranslationTarget Class
- java.
lang. Object - com.
azure. ai. translation. text. models. TranslationTarget
- com.
Implements
public final class TranslationTarget
implements JsonSerializable<TranslationTarget>
Target language and translation configuration parameters.
Constructor Summary
| Constructor | Description |
|---|---|
| TranslationTarget(String language) |
Creates an instance of Translation |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
static
Translation |
fromJson(JsonReader jsonReader)
Reads an instance of Translation |
| String |
getAdaptiveDatasetId()
Get the adaptive |
| String |
getDeploymentName()
Get the deployment |
|
Translation |
getGender()
Get the gender property: Desired gender of target translation. |
| String |
getLanguage()
Get the language property: Specifies the language of the output text. |
|
Profanity |
getProfanityAction()
Get the profanity |
|
Profanity |
getProfanityMarker()
Get the profanity |
|
List<Reference |
getReferenceTextPairs()
Get the reference |
| String |
getScript()
Get the script property: Specifies the script of the translated text. |
|
Translation |
getTone()
Get the tone property: Desired tone of target translation. |
| Boolean |
isAllowFallback()
Get the allow |
|
Translation |
setAdaptiveDatasetId(String adaptiveDatasetId)
Set the adaptive |
|
Translation |
setAllowFallback(Boolean allowFallback)
Set the allow |
|
Translation |
setDeploymentName(String deploymentName)
Set the deployment |
|
Translation |
setGender(TranslationGender gender)
Set the gender property: Desired gender of target translation. |
|
Translation |
setProfanityAction(ProfanityAction profanityAction)
Set the profanity |
|
Translation |
setProfanityMarker(ProfanityMarker profanityMarker)
Set the profanity |
|
Translation |
setReferenceTextPairs(List<ReferenceTextPair> referenceTextPairs)
Set the reference |
|
Translation |
setScript(String script)
Set the script property: Specifies the script of the translated text. |
|
Translation |
setTone(TranslationTone tone)
Set the tone property: Desired tone of target translation. |
|
Json |
toJson(JsonWriter jsonWriter) |
Methods inherited from java.lang.Object
Constructor Details
TranslationTarget
public TranslationTarget(String language)
Creates an instance of TranslationTarget class.
Parameters:
Method Details
fromJson
public static TranslationTarget fromJson(JsonReader jsonReader)
Reads an instance of TranslationTarget from the JsonReader.
Parameters:
Returns:
Throws:
getAdaptiveDatasetId
public String getAdaptiveDatasetId()
Get the adaptiveDatasetId property: Reference dataset ID having sentence pair to generate adaptive customized translation.
Returns:
getDeploymentName
public String getDeploymentName()
Get the deploymentName property: Default is 'general', which uses NMT system. 'abc-inc-gpt-4o', and 'abc-inc-gpt-4o-mini' are examples of deployment names which use GPT-4o uses or GPT-4o-mini model. 'gpt-4o' uses GPT-4o model. '<custom model id>' uses the custom NMT model tuned by customer. 'best' system determines which is the best model to use for the request. This intelligence could be introduced in future. Customer should have deployed it in their resource.
Returns:
getGender
public TranslationGender getGender()
Get the gender property: Desired gender of target translation. Accepted values are female, male, or neutral.
Returns:
getLanguage
public String getLanguage()
Get the language property: Specifies the language of the output text. The target language must be one of the supported languages included in the translation scope. It's possible to translate to multiple languages simultaneously by including multiple string values in the targetsLanguage array.
Returns:
getProfanityAction
public ProfanityAction getProfanityAction()
Get the profanityAction property: Specifies how profanities should be treated in translations. Possible values are: NoAction (default), Marked or Deleted.
Returns:
getProfanityMarker
public ProfanityMarker getProfanityMarker()
Get the profanityMarker property: Specifies how profanities should be marked in translations. Possible values are: Asterisk (default) or Tag.
Returns:
getReferenceTextPairs
public List<ReferenceTextPair> getReferenceTextPairs()
Get the referenceTextPairs property: Reference text pairs to generate adaptive customized translation.
Returns:
getScript
public String getScript()
Get the script property: Specifies the script of the translated text.
Returns:
getTone
public TranslationTone getTone()
Get the tone property: Desired tone of target translation. Accepted values are formal, informal, or neutral.
Returns:
isAllowFallback
public Boolean isAllowFallback()
Get the allowFallback property: In the case where a custom system is being used, specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. In the case where a Large Language Model is being used, specifies that the service is allowed to fall back to a Small Language Model if an error occurs. Possible values are: true (default) or false. allowFallback=false specifies that the translation should only use systems trained for the category specified by the request. If a translation for language X to language Y requires chaining through a pivot language E, then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category. If no system is found with the specific category, the request will return a 400 status code. allowFallback=true specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
Returns:
setAdaptiveDatasetId
public TranslationTarget setAdaptiveDatasetId(String adaptiveDatasetId)
Set the adaptiveDatasetId property: Reference dataset ID having sentence pair to generate adaptive customized translation.
Parameters:
Returns:
setAllowFallback
public TranslationTarget setAllowFallback(Boolean allowFallback)
Set the allowFallback property: In the case where a custom system is being used, specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. In the case where a Large Language Model is being used, specifies that the service is allowed to fall back to a Small Language Model if an error occurs. Possible values are: true (default) or false. allowFallback=false specifies that the translation should only use systems trained for the category specified by the request. If a translation for language X to language Y requires chaining through a pivot language E, then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category. If no system is found with the specific category, the request will return a 400 status code. allowFallback=true specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
Parameters:
Returns:
setDeploymentName
public TranslationTarget setDeploymentName(String deploymentName)
Set the deploymentName property: Default is 'general', which uses NMT system. 'abc-inc-gpt-4o', and 'abc-inc-gpt-4o-mini' are examples of deployment names which use GPT-4o uses or GPT-4o-mini model. 'gpt-4o' uses GPT-4o model. '<custom model id>' uses the custom NMT model tuned by customer. 'best' system determines which is the best model to use for the request. This intelligence could be introduced in future. Customer should have deployed it in their resource.
Parameters:
Returns:
setGender
public TranslationTarget setGender(TranslationGender gender)
Set the gender property: Desired gender of target translation. Accepted values are female, male, or neutral.
Parameters:
Returns:
setProfanityAction
public TranslationTarget setProfanityAction(ProfanityAction profanityAction)
Set the profanityAction property: Specifies how profanities should be treated in translations. Possible values are: NoAction (default), Marked or Deleted.
Parameters:
Returns:
setProfanityMarker
public TranslationTarget setProfanityMarker(ProfanityMarker profanityMarker)
Set the profanityMarker property: Specifies how profanities should be marked in translations. Possible values are: Asterisk (default) or Tag.
Parameters:
Returns:
setReferenceTextPairs
public TranslationTarget setReferenceTextPairs(List<ReferenceTextPair> referenceTextPairs)
Set the referenceTextPairs property: Reference text pairs to generate adaptive customized translation.
Parameters:
Returns:
setScript
public TranslationTarget setScript(String script)
Set the script property: Specifies the script of the translated text.
Parameters:
Returns:
setTone
public TranslationTarget setTone(TranslationTone tone)
Set the tone property: Desired tone of target translation. Accepted values are formal, informal, or neutral.
Parameters:
Returns: