azure.ai.translation.text.models package

class azure.ai.translation.text.models.BackTranslation(*args: Any, **kwargs: Any)[source]

Back Translation.

All required parameters must be populated in order to send to server.

Variables:
  • normalized_text (str) – A string giving the normalized form of the source term that is a back-translation of the target. This value should be used as input to lookup examples. Required.

  • display_text (str) – A string giving the source term that is a back-translation of the target in a form best suited for end-user display. Required.

  • num_examples (int) – An integer representing the number of examples that are available for this translation pair. Actual examples must be retrieved with a separate call to lookup examples. The number is mostly intended to facilitate display in a UX. For example, a user interface may add a hyperlink to the back-translation if the number of examples is greater than zero and show the back-translation as plain text if there are no examples. Note that the actual number of examples returned by a call to lookup examples may be less than numExamples, because additional filtering may be applied on the fly to remove “bad” examples. Required.

  • frequency_count (int) – An integer representing the frequency of this translation pair in the data. The main purpose of this field is to provide a user interface with a means to sort back-translations so the most frequent terms are first. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
display_text: str

A string giving the source term that is a back-translation of the target in a form best suited for end-user display. Required.

frequency_count: int

An integer representing the frequency of this translation pair in the data. The main purpose of this field is to provide a user interface with a means to sort back-translations so the most frequent terms are first. Required.

normalized_text: str

A string giving the normalized form of the source term that is a back-translation of the target. This value should be used as input to lookup examples. Required.

num_examples: int

An integer representing the number of examples that are available for this translation pair. Actual examples must be retrieved with a separate call to lookup examples. The number is mostly intended to facilitate display in a UX. For example, a user interface may add a hyperlink to the back-translation if the number of examples is greater than zero and show the back-translation as plain text if there are no examples. Note that the actual number of examples returned by a call to lookup examples may be less than numExamples, because additional filtering may be applied on the fly to remove “bad” examples. Required.

class azure.ai.translation.text.models.BreakSentenceItem(*args: Any, **kwargs: Any)[source]

Item containing break sentence result.

All required parameters must be populated in order to send to server.

Variables:
  • detected_language (DetectedLanguage) – The detectedLanguage property is only present in the result object when language auto-detection is requested.

  • sent_len (list[int]) – An integer array representing the lengths of the sentences in the input text. The length of the array is the number of sentences, and the values are the length of each sentence. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
detected_language: _models.DetectedLanguage | None

The detectedLanguage property is only present in the result object when language auto-detection is requested.

sent_len: List[int]

An integer array representing the lengths of the sentences in the input text. The length of the array is the number of sentences, and the values are the length of each sentence. Required.

class azure.ai.translation.text.models.DetectedLanguage(*args: Any, **kwargs: Any)[source]

An object describing the detected language.

All required parameters must be populated in order to send to server.

Variables:
  • language (str) – A string representing the code of the detected language. Required.

  • score (float) – A float value indicating the confidence in the result. The score is between zero and one and a low score indicates a low confidence. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
language: str

A string representing the code of the detected language. Required.

score: float

A float value indicating the confidence in the result. The score is between zero and one and a low score indicates a low confidence. Required.

class azure.ai.translation.text.models.DictionaryExample(*args: Any, **kwargs: Any)[source]

Dictionary Example.

All required parameters must be populated in order to send to server.

Variables:
  • source_prefix (str) – The string to concatenate before the value of sourceTerm to form a complete example. Do not add a space character, since it is already there when it should be. This value may be an empty string. Required.

  • source_term (str) – A string equal to the actual term looked up. The string is added with sourcePrefix and sourceSuffix to form the complete example. Its value is separated so it can be marked in a user interface, e.g., by bolding it. Required.

  • source_suffix (str) – The string to concatenate after the value of sourceTerm to form a complete example. Do not add a space character, since it is already there when it should be. This value may be an empty string. Required.

  • target_prefix (str) – A string similar to sourcePrefix but for the target. Required.

  • target_term (str) – A string similar to sourceTerm but for the target. Required.

  • target_suffix (str) – A string similar to sourceSuffix but for the target. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
source_prefix: str

The string to concatenate before the value of sourceTerm to form a complete example. Do not add a space character, since it is already there when it should be. This value may be an empty string. Required.

source_suffix: str

The string to concatenate after the value of sourceTerm to form a complete example. Do not add a space character, since it is already there when it should be. This value may be an empty string. Required.

source_term: str

A string equal to the actual term looked up. The string is added with sourcePrefix and sourceSuffix to form the complete example. Its value is separated so it can be marked in a user interface, e.g., by bolding it. Required.

target_prefix: str

A string similar to sourcePrefix but for the target. Required.

target_suffix: str

A string similar to sourceSuffix but for the target. Required.

target_term: str

A string similar to sourceTerm but for the target. Required.

class azure.ai.translation.text.models.DictionaryExampleItem(*args: Any, **kwargs: Any)[source]

Dictionary Example element.

All required parameters must be populated in order to send to server.

Variables:
  • normalized_source (str) – A string giving the normalized form of the source term. Generally, this should be identical to the value of the Text field at the matching list index in the body of the request. Required.

  • normalized_target (str) – A string giving the normalized form of the target term. Generally, this should be identical to the value of the Translation field at the matching list index in the body of the request. Required.

  • examples (list[DictionaryExample]) – A list of examples for the (source term, target term) pair. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
examples: List[_models.DictionaryExample]

A list of examples for the (source term, target term) pair. Required.

normalized_source: str

A string giving the normalized form of the source term. Generally, this should be identical to the value of the Text field at the matching list index in the body of the request. Required.

normalized_target: str

A string giving the normalized form of the target term. Generally, this should be identical to the value of the Translation field at the matching list index in the body of the request. Required.

class azure.ai.translation.text.models.DictionaryExampleTextItem(*args: Any, **kwargs: Any)[source]

Element containing the text with translation.

All required parameters must be populated in order to send to server.

Variables:
  • text (str) – Text to translate. Required.

  • translation (str) – A string specifying the translated text previously returned by the Dictionary lookup operation. This should be the value from the normalizedTarget field in the translations list of the Dictionary lookup response. The service will return examples for the specific source-target word-pair. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
text: str

Text to translate. Required.

translation: str

A string specifying the translated text previously returned by the Dictionary lookup operation. This should be the value from the normalizedTarget field in the translations list of the Dictionary lookup response. The service will return examples for the specific source-target word-pair. Required.

class azure.ai.translation.text.models.DictionaryLookupItem(*args: Any, **kwargs: Any)[source]

Dictionary Lookup Element.

All required parameters must be populated in order to send to server.

Variables:
  • normalized_source (str) – A string giving the normalized form of the source term. For example, if the request is “JOHN”, the normalized form will be “john”. The content of this field becomes the input to lookup examples. Required.

  • display_source (str) – A string giving the source term in a form best suited for end-user display. For example, if the input is “JOHN”, the display form will reflect the usual spelling of the name: “John”. Required.

  • translations (list[DictionaryTranslation]) – A list of translations for the source term. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
display_source: str

A string giving the source term in a form best suited for end-user display. For example, if the input is “JOHN”, the display form will reflect the usual spelling of the name: “John”. Required.

normalized_source: str

A string giving the normalized form of the source term. For example, if the request is “JOHN”, the normalized form will be “john”. The content of this field becomes the input to lookup examples. Required.

translations: List[_models.DictionaryTranslation]

A list of translations for the source term. Required.

class azure.ai.translation.text.models.DictionaryTranslation(*args: Any, **kwargs: Any)[source]

Translation source term.

All required parameters must be populated in order to send to server.

Variables:
  • normalized_target (str) – A string giving the normalized form of this term in the target language. This value should be used as input to lookup examples. Required.

  • display_target (str) – A string giving the term in the target language and in a form best suited for end-user display. Generally, this will only differ from the normalizedTarget in terms of capitalization. For example, a proper noun like “Juan” will have normalizedTarget = “juan” and displayTarget = “Juan”. Required.

  • pos_tag (str) – A string associating this term with a part-of-speech tag. Required.

  • confidence (float) – A value between 0.0 and 1.0 which represents the “confidence” (or perhaps more accurately, “probability in the training data”) of that translation pair. The sum of confidence scores for one source word may or may not sum to 1.0. Required.

  • prefix_word (str) – A string giving the word to display as a prefix of the translation. Currently, this is the gendered determiner of nouns, in languages that have gendered determiners. For example, the prefix of the Spanish word “mosca” is “la”, since “mosca” is a feminine noun in Spanish. This is only dependent on the translation, and not on the source. If there is no prefix, it will be the empty string. Required.

  • back_translations (list[BackTranslation]) – A list of “back translations” of the target. For example, source words that the target can translate to. The list is guaranteed to contain the source word that was requested (e.g., if the source word being looked up is “fly”, then it is guaranteed that “fly” will be in the backTranslations list). However, it is not guaranteed to be in the first position, and often will not be. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
back_translations: List[_models.BackTranslation]

A list of “back translations” of the target. For example, source words that the target can translate to. The list is guaranteed to contain the source word that was requested (e.g., if the source word being looked up is “fly”, then it is guaranteed that “fly” will be in the backTranslations list). However, it is not guaranteed to be in the first position, and often will not be. Required.

confidence: float

A value between 0.0 and 1.0 which represents the “confidence” (or perhaps more accurately, “probability in the training data”) of that translation pair. The sum of confidence scores for one source word may or may not sum to 1.0. Required.

display_target: str

A string giving the term in the target language and in a form best suited for end-user display. Generally, this will only differ from the normalizedTarget in terms of capitalization. For example, a proper noun like “Juan” will have normalizedTarget = “juan” and displayTarget = “Juan”. Required.

normalized_target: str

A string giving the normalized form of this term in the target language. This value should be used as input to lookup examples. Required.

pos_tag: str

A string associating this term with a part-of-speech tag. Required.

prefix_word: str

A string giving the word to display as a prefix of the translation. Currently, this is the gendered determiner of nouns, in languages that have gendered determiners. For example, the prefix of the Spanish word “mosca” is “la”, since “mosca” is a feminine noun in Spanish. This is only dependent on the translation, and not on the source. If there is no prefix, it will be the empty string. Required.

class azure.ai.translation.text.models.ErrorDetails(*args: Any, **kwargs: Any)[source]

Error details as returned by Translator Service.

All required parameters must be populated in order to send to server.

Variables:
  • code (int) – Number identifier of the error. Required.

  • message (str) – Human readable error description. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
code: int

Number identifier of the error. Required.

message: str

Human readable error description. Required.

class azure.ai.translation.text.models.ErrorResponse(*args: Any, **kwargs: Any)[source]

Representation of the Error Response from Translator Service.

All required parameters must be populated in order to send to server.

Variables:

error (ErrorDetails) – Error details. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
error: _models.ErrorDetails

Error details. Required.

class azure.ai.translation.text.models.GetSupportedLanguagesResult(*args: Any, **kwargs: Any)[source]

Response for the languages API.

Variables:
as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
dictionary: Dict[str, _models.SourceDictionaryLanguage] | None

Languages that support dictionary API.

translation: Dict[str, _models.TranslationLanguage] | None

Languages that support translate API.

transliteration: Dict[str, _models.TransliterationLanguage] | None

Languages that support transliteration API.

class azure.ai.translation.text.models.InputTextItem(*args: Any, **kwargs: Any)[source]

Element containing the text for translation.

All required parameters must be populated in order to send to server.

Variables:

text (str) – Text to translate. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
text: str

Text to translate. Required.

class azure.ai.translation.text.models.LanguageDirectionality(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Language Directionality.

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

LEFT_TO_RIGHT = 'ltr'

Language is written left to right.

RIGHT_TO_LEFT = 'rtl'

Language is written right to left.

class azure.ai.translation.text.models.LanguageScript(*args: Any, **kwargs: Any)[source]

Common properties of language script.

All required parameters must be populated in order to send to server.

Variables:
  • code (str) – Code identifying the script. Required.

  • name (str) – Display name of the script in the locale requested via Accept-Language header. Required.

  • native_name (str) – Display name of the language in the locale native for the language. Required.

  • dir (str or LanguageDirectionality) – Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. Required. Known values are: “ltr” and “rtl”.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
code: str

Code identifying the script. Required.

dir: str | _models.LanguageDirectionality

Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. Required. Known values are: “ltr” and “rtl”.

name: str

Display name of the script in the locale requested via Accept-Language header. Required.

native_name: str

Display name of the language in the locale native for the language. Required.

class azure.ai.translation.text.models.ProfanityAction(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Translator profanity actions.

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

DELETED = 'Deleted'

Profanity is deleted from the translated text.

MARKED = 'Marked'

Profanity is marked.

NO_ACTION = 'NoAction'

No Action is taken on profanity

class azure.ai.translation.text.models.ProfanityMarker(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Translator profanity markers.

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

ASTERISK = 'Asterisk'

Profanity is marked with asterisk.

TAG = 'Tag'

Profanity is marked with the tags.

class azure.ai.translation.text.models.SentenceBoundaries(*args: Any, **kwargs: Any)[source]

An object returning sentence boundaries in the input and output texts.

All required parameters must be populated in order to send to server.

Variables:
  • src_sent_len (list[int]) – An integer array representing the lengths of the sentences in the input text. The length of the array is the number of sentences, and the values are the length of each sentence. Required.

  • trans_sent_len (list[int]) – An integer array representing the lengths of the sentences in the translated text. The length of the array is the number of sentences, and the values are the length of each sentence. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
src_sent_len: List[int]

An integer array representing the lengths of the sentences in the input text. The length of the array is the number of sentences, and the values are the length of each sentence. Required.

trans_sent_len: List[int]

An integer array representing the lengths of the sentences in the translated text. The length of the array is the number of sentences, and the values are the length of each sentence. Required.

class azure.ai.translation.text.models.SourceDictionaryLanguage(*args: Any, **kwargs: Any)[source]

Properties ot the source dictionary language.

All required parameters must be populated in order to send to server.

Variables:
  • name (str) – Display name of the language in the locale requested via Accept-Language header. Required.

  • native_name (str) – Display name of the language in the locale native for this language. Required.

  • dir (str or LanguageDirectionality) – Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. Required. Known values are: “ltr” and “rtl”.

  • translations (list[TargetDictionaryLanguage]) – List of languages with alterative translations and examples for the query expressed in the source language. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
dir: str | _models.LanguageDirectionality

Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. Required. Known values are: “ltr” and “rtl”.

name: str

Display name of the language in the locale requested via Accept-Language header. Required.

native_name: str

Display name of the language in the locale native for this language. Required.

translations: List[_models.TargetDictionaryLanguage]

List of languages with alterative translations and examples for the query expressed in the source language. Required.

class azure.ai.translation.text.models.SourceText(*args: Any, **kwargs: Any)[source]

Input text in the default script of the source language.

All required parameters must be populated in order to send to server.

Variables:

text (str) – Input text in the default script of the source language. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
text: str

Input text in the default script of the source language. Required.

class azure.ai.translation.text.models.TargetDictionaryLanguage(*args: Any, **kwargs: Any)[source]

Properties of the target dictionary language.

All required parameters must be populated in order to send to server.

Variables:
  • name (str) – Display name of the language in the locale requested via Accept-Language header. Required.

  • native_name (str) – Display name of the language in the locale native for this language. Required.

  • dir (str or LanguageDirectionality) – Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. Required. Known values are: “ltr” and “rtl”.

  • code (str) – Language code identifying the target language. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
code: str

Language code identifying the target language. Required.

dir: str | _models.LanguageDirectionality

Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. Required. Known values are: “ltr” and “rtl”.

name: str

Display name of the language in the locale requested via Accept-Language header. Required.

native_name: str

Display name of the language in the locale native for this language. Required.

class azure.ai.translation.text.models.TextType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Translation text type.

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

HTML = 'Html'

HTML-encoded text.

PLAIN = 'Plain'

Plain text.

class azure.ai.translation.text.models.TranslatedTextAlignment(*args: Any, **kwargs: Any)[source]

Alignment information object.

All required parameters must be populated in order to send to server.

Variables:

proj (str) – Maps input text to translated text. The alignment information is only provided when the request parameter includeAlignment is true. Alignment is returned as a string value of the following format: [[SourceTextStartIndex]:[SourceTextEndIndex]–[TgtTextStartIndex]:[TgtTextEndIndex]]. The colon separates start and end index, the dash separates the languages, and space separates the words. One word may align with zero, one, or multiple words in the other language, and the aligned words may be non-contiguous. When no alignment information is available, the alignment element will be empty. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
proj: str

Maps input text to translated text. The alignment information is only provided when the request parameter includeAlignment is true. Alignment is returned as a string value of the following format: [[SourceTextStartIndex]:[SourceTextEndIndex]–[TgtTextStartIndex]:[TgtTextEndIndex]]. The colon separates start and end index, the dash separates the languages, and space separates the words. One word may align with zero, one, or multiple words in the other language, and the aligned words may be non-contiguous. When no alignment information is available, the alignment element will be empty. Required.

class azure.ai.translation.text.models.TranslatedTextItem(*args: Any, **kwargs: Any)[source]

Element containing the translated text.

All required parameters must be populated in order to send to server.

Variables:
  • detected_language (DetectedLanguage) – The detectedLanguage property is only present in the result object when language auto-detection is requested.

  • translations (list[TranslationText]) – An array of translation results. The size of the array matches the number of target languages specified through the to query parameter. Required.

  • source_text (SourceText) – Input text in the default script of the source language. sourceText property is present only when the input is expressed in a script that’s not the usual script for the language. For example, if the input were Arabic written in Latin script, then sourceText.text would be the same Arabic text converted into Arab script.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
detected_language: _models.DetectedLanguage | None

The detectedLanguage property is only present in the result object when language auto-detection is requested.

source_text: _models.SourceText | None

Input text in the default script of the source language. sourceText property is present only when the input is expressed in a script that’s not the usual script for the language. For example, if the input were Arabic written in Latin script, then sourceText.text would be the same Arabic text converted into Arab script.

translations: List[_models.TranslationText]

An array of translation results. The size of the array matches the number of target languages specified through the to query parameter. Required.

class azure.ai.translation.text.models.TranslationLanguage(*args: Any, **kwargs: Any)[source]

The value of the translation property is a dictionary of (key, value) pairs. Each key is a BCP 47 language tag. A key identifies a language for which text can be translated to or translated from.

All required parameters must be populated in order to send to server.

Variables:
  • name (str) – Display name of the language in the locale requested via Accept-Language header. Required.

  • native_name (str) – Display name of the language in the locale native for this language. Required.

  • dir (str or LanguageDirectionality) – Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. Required. Known values are: “ltr” and “rtl”.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
dir: str | _models.LanguageDirectionality

Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. Required. Known values are: “ltr” and “rtl”.

name: str

Display name of the language in the locale requested via Accept-Language header. Required.

native_name: str

Display name of the language in the locale native for this language. Required.

class azure.ai.translation.text.models.TranslationText(*args: Any, **kwargs: Any)[source]

Translation result.

All required parameters must be populated in order to send to server.

Variables:
  • to (str) – A string representing the language code of the target language. Required.

  • text (str) – A string giving the translated text. Required.

  • transliteration (TransliteratedText) – An object giving the translated text in the script specified by the toScript parameter.

  • alignment (TranslatedTextAlignment) – Alignment information.

  • sent_len (SentenceBoundaries) – Sentence boundaries in the input and output texts.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
alignment: _models.TranslatedTextAlignment | None

Alignment information.

sent_len: _models.SentenceBoundaries | None

Sentence boundaries in the input and output texts.

text: str

A string giving the translated text. Required.

to: str

A string representing the language code of the target language. Required.

transliteration: _models.TransliteratedText | None

An object giving the translated text in the script specified by the toScript parameter.

class azure.ai.translation.text.models.TransliterableScript(*args: Any, **kwargs: Any)[source]

Script definition with list of script into which given script can be translitered.

All required parameters must be populated in order to send to server.

Variables:
  • code (str) – Code identifying the script. Required.

  • name (str) – Display name of the script in the locale requested via Accept-Language header. Required.

  • native_name (str) – Display name of the language in the locale native for the language. Required.

  • dir (str or LanguageDirectionality) – Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. Required. Known values are: “ltr” and “rtl”.

  • to_scripts (list[LanguageScript]) – List of scripts available to convert text to. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
code: str

Code identifying the script. Required.

dir: str | '_models.LanguageDirectionality'

Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. Required. Known values are: “ltr” and “rtl”.

name: str

Display name of the script in the locale requested via Accept-Language header. Required.

native_name: str

Display name of the language in the locale native for the language. Required.

to_scripts: List[_models.LanguageScript]

List of scripts available to convert text to. Required.

class azure.ai.translation.text.models.TransliteratedText(*args: Any, **kwargs: Any)[source]

Transliterated text element.

All required parameters must be populated in order to send to server.

Variables:
  • text (str) – A string which is the result of converting the input string to the output script. Required.

  • script (str) – A string specifying the script used in the output. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
script: str

A string specifying the script used in the output. Required.

text: str

A string which is the result of converting the input string to the output script. Required.

class azure.ai.translation.text.models.TransliterationLanguage(*args: Any, **kwargs: Any)[source]

The value of the transliteration property is a dictionary of (key, value) pairs. Each key is a BCP 47 language tag. A key identifies a language for which text can be converted from one script to another script.

All required parameters must be populated in order to send to server.

Variables:
  • name (str) – Display name of the language in the locale requested via Accept-Language header. Required.

  • native_name (str) – Display name of the language in the locale native for this language. Required.

  • scripts (list[TransliterableScript]) – List of scripts to convert from. Required.

as_dict(*, exclude_readonly: bool = False) Dict[str, Any]

Return a dict that can be JSONify using json.dump.

Keyword Arguments:

exclude_readonly (bool) – Whether to remove the readonly properties.

Returns:

A dict JSON compatible object

Return type:

dict

clear() None.  Remove all items from D.
copy() Model
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
name: str

Display name of the language in the locale requested via Accept-Language header. Required.

native_name: str

Display name of the language in the locale native for this language. Required.

scripts: List[_models.TransliterableScript]

List of scripts to convert from. Required.