Translate Middleware
The Translate Middleware library is a use to translate text using cognitive services translator.
Cognitive Services Translator is a cloud-based machine translation service you can to translate text in with a simple REST API call
Installing
pip install botbuilder-sangamam-cognitive-text-translate
Usage
All middleware is created and used in the same way. For example, import the TranslateMiddleware class from the package, and add it to your bot adapter:
from botbuilder.sangamam.cognitive.text.translate import TranslateMiddleware , TranslateSettings
translate_settings = TranslateSettings()
translate_settings.subscription_key = ''
translate_settings.from_lang = 'en'
translate_settings.to_lang = ['de','it','ta']
translate_settings.subscription_region = ''
adapter.use(TranslateMiddleware(translate_settings));
When used, the turn_state on the TurnContext will have a property named translate_response, which will be an return an TranslateResponse object.
Supported middleware classes include:
| Class | Property/Properties on turn_state |
|---|---|
TranslateMiddleware |
context.turn_state.get("translate_response") |
TranslateService
TranslateService is use to translate text using cognitive services translator without Middleware.
from botbuilder.sangamam.cognitive.text.translate import TranslateService , TranslateSettings ,TranslateResponse
translate_settings = TranslateSettings()
translate_settings.subscription_key = ''
translate_settings.from_lang = 'en'
translate_settings.to_lang = ['de','it','ta']
translate_settings.subscription_region = ''
//call the translate service
service = TranslateService(translate_settings)
response = service.translate_text('hello')
Metadata
Release files for botbuilder-sangamam-cognitive-text-translate 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| botbuilder-sangamam-cognitive-text-translate-0.3.0.tar.gz | 3.7 kB | Without provenance | Details for botbuilder-sangamam-cognitive-text-translate-0.3.0.tar.gz |
Release files / botbuilder-sangamam-cognitive-text-translate-0.3.0.tar.gz
| Download URL | botbuilder-sangamam-cognitive-text-translate-0.3.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf2682e42e43bbfcf67fd6560c7849ab1c0d56507d9d7ac703f310bfc9fa6158
|
|
BLAKE2b-256 checksum How to use checksums |
72ee9a2adfc7ffaa77d2adc61551320af0efdfa58a505da7501c1735466583b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Security for botbuilder-sangamam-cognitive-text-translate 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.