Specify Translation Options
The Translate function of
the API supports numerous parameters that affect the output.
Word Alignment
Words in written English
(written in Latin script) are separated by spaces. This isn't always the case,
though, in several other languages, more especially, scripts.
For example, translating
"Smart Services" from en (English) to zh (Simplified Chinese)
produces the result "智能服务", and it's
difficult to understand the relationship between the characters in the source
text and the corresponding characters in the translation. To resolve this
problem, you can specify the includeAlignment parameter with a value of true in
your call to produce the result.
Sentence Length
When deciding how best to
display a translation in a user interface, for instance, it may be helpful to
know the translation's length (i.e., character count). By making the
includeSentenceLength argument true, you can obtain this data.
Profanity Filtering
Profanity can
occasionally be found in text; in a translation, you could want to hide it or
leave it out completely. The profanityAction option, which has one of the
following values, can be used to manage profanities:
NoAction-
Profanities are translated along with the rest of the text.
Deleted-
Profanities are omitted in the translation.
Marked-
Profanities are indicated using the technique indicated in the profanityMarker
parameter (if supplied). The default value for this parameter is Asterisk,
which replaces characters in profanities with "*". As an alternative,
you can specify a profanityMarker value of Tag, which causes profanities to be
enclosed in XML tags.
Conclusion
We have successfully
learnt about translation options.
Comments
Post a Comment